From f6c0965f8563b6e97c7593f4ec49f8efbf9b385d Mon Sep 17 00:00:00 2001 From: jr-k Date: Thu, 8 Aug 2024 02:44:03 +0200 Subject: [PATCH] add nightly build --- .../{master.yml => common-docker-build.yml} | 24 +++--------- .github/workflows/nightly-build.yml | 37 +++++++++++++++++++ .github/workflows/release-build.yml | 19 ++++++++++ 3 files changed, 61 insertions(+), 19 deletions(-) rename .github/workflows/{master.yml => common-docker-build.yml} (62%) create mode 100755 .github/workflows/nightly-build.yml create mode 100755 .github/workflows/release-build.yml diff --git a/.github/workflows/master.yml b/.github/workflows/common-docker-build.yml similarity index 62% rename from .github/workflows/master.yml rename to .github/workflows/common-docker-build.yml index 32df79b..6a7cbf5 100755 --- a/.github/workflows/master.yml +++ b/.github/workflows/common-docker-build.yml @@ -1,13 +1,6 @@ -name: Build and Push Docker images - -on: - push: - branches: - - master - paths: - - 'version.txt' - workflow_dispatch: +name: Common Docker Build +on: [push] jobs: build-and-push: @@ -15,10 +8,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Read Version - id: version - run: echo "::set-output name=VERSION::$(cat version.txt)" - - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -37,15 +26,12 @@ jobs: context: . file: ./Dockerfile push: true - tags: | - jierka/obscreen:v${{ steps.version.outputs.VERSION }} - jierka/obscreen:latest + tags: ${{ inputs.build_tags }} platforms: linux/amd64, linux/arm64/v8, linux/arm/v7 - name: Create and push manifest uses: docker/metadata-action@v3 with: images: jierka/obscreen - tags: type=semver,pattern=v{{version}} - flavor: | - latest=true + tags: ${{ inputs.manifest_tags }} + flavor: ${{ inputs.flavor }} diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml new file mode 100755 index 0000000..72763b9 --- /dev/null +++ b/.github/workflows/nightly-build.yml @@ -0,0 +1,37 @@ +name: Nightly synced with develop, build and push docker images + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + sync-and-build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: develop + + - name: Set up Git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + - name: Sync nightly branch + run: | + git checkout nightly + git merge develop --no-edit + git push origin nightly --force + + - name: Checkout nightly branch + uses: actions/checkout@v2 + with: + ref: nightly + + - name: Call common build workflow + uses: ./.github/workflows/common-docker-build.yml + with: + build_tags: jierka/obscreen:nightly + manifest_tags: type=semver,pattern=nightly + flavor: "" diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100755 index 0000000..7ce3aed --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,19 @@ +name: Release build and push docker images + +on: + push: + branches: + - master + paths: + - 'version.txt' + workflow_dispatch: + +jobs: + build-and-push: + uses: ./.github/workflows/common-docker-build.yml + with: + build_tags: | + jierka/obscreen:v${{ github.run_number }} + jierka/obscreen:latest + manifest_tags: type=semver,pattern=v${{ github.run_number }} + flavor: latest=true