Skip to content

Docker Build And Push #85

Docker Build And Push

Docker Build And Push #85

Workflow file for this run

name: Docker Build And Push
on:
schedule:
- cron: "0 0 * * *"
jobs:
check:
runs-on: 'ubuntu-latest'
steps:
- uses: octokit/request-action@v2.x
id: check_last_run
with:
route: GET /repos/${{github.repository}}/actions/workflows/main.yml/runs?per_page=1&status=completed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo Last daily build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}"
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
build:
runs-on: ubuntu-latest
needs: [check]
if: needs.check.outputs.last_sha != github.sha
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Build Debian package
uses: docker/build-push-action@v5
with:
load: true
push: false
target: builder
context: .
tags: lego-technic-deb:latest
- name: Extract to host
uses: shrink/actions-docker-extract@v3
id: extract
with:
image: lego-technic-deb:latest
path: /dist/.
destination: ./dist
- name: Push to Gemfury
run: |
debfile=$(find ./dist/*.deb)
curl -F package=@$debfile https://${{ secrets.GEMFURY_TOKEN }}@push.fury.io/debilin/
- name: Download credential helper
id: download_release
uses: robinraju/release-downloader@v1.8
with:
repository: "docker/docker-credential-helpers"
latest: true
fileName: "docker-credential-pass-*.linux-amd64"
- name: Add credential helper
run: |
sudo apt-get install -y gnupg2 pass
mv ${{ fromJson(steps.download_release.outputs.downloaded_files)[0] }} /usr/local/bin/docker-credential-pass
pass init docker-github-workflow
echo "{\n\t"credsStore": "pass"\n}" >> $HOME/.docker/config.json
- name: Build Docker Image
id: buildAndPushImage
uses: MaximilianoBz/dockerhub-buildpush@v1.0
with:
registry_url: 'docker.io'
repository_name: 'lego-technic'
user_name: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
image_version: 'nightly'
docker_file: '.'
- name: Get pre step result output image_pull_url
run: echo "The time was ${{ steps.buildAndPushImage.outputs.image_pull_url }}"