Skip to content

Trigger daily only if there is new commit. #13

Trigger daily only if there is new commit.

Trigger daily only if there is new commit. #13

Workflow file for this run

name: Docker Build And Push

Check failure on line 1 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

Cannot define both `uses` and `steps` at the same time for the following jobs: build
on:
schedule:
- cron: "30 01 * * *"
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.MY_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:
needs: [check]
if: needs.check.outputs.last_sha != github.sha
uses: ./.github/workflows/dothebuild.yml
secrets: inherit
name: Build LEGO Technic
runs-on: ubuntu-latest
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: 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 }}"