From 46e0720951a3e5a7a8c0ae47d3629dce14290eef Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Oct 2024 12:13:29 +0200 Subject: [PATCH] Add github action workflow to build nightly images for releases --- .github/workflows/build-container-image.yml | 4 ++ .github/workflows/build-stable-nightly.yml | 66 +++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/build-stable-nightly.yml diff --git a/.github/workflows/build-container-image.yml b/.github/workflows/build-container-image.yml index 03a0f5bf37..6e4b6632d3 100644 --- a/.github/workflows/build-container-image.yml +++ b/.github/workflows/build-container-image.yml @@ -1,6 +1,9 @@ on: workflow_call: inputs: + branch: + required: false + type: string platforms: required: true type: string @@ -30,6 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 + ref: ${{ inputs.branch || '' }} - uses: docker/setup-qemu-action@v3 if: contains(inputs.platforms, 'linux/arm64') && !inputs.use_native_arm64_builder diff --git a/.github/workflows/build-stable-nightly.yml b/.github/workflows/build-stable-nightly.yml new file mode 100644 index 0000000000..7aafafb3b1 --- /dev/null +++ b/.github/workflows/build-stable-nightly.yml @@ -0,0 +1,66 @@ +name: Build nightly container image (stable branches) +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * *' # run at 2 AM UTC + +permissions: + contents: read + packages: write + +jobs: + compute-suffix: + runs-on: ubuntu-latest + if: github.repository == 'mastodon/mastodon' + steps: + - id: version_vars + env: + TZ: Etc/UTC + run: | + echo mastodon_version_prerelease=4.3-nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT + outputs: + prerelease: ${{ steps.version_vars.outputs.mastodon_version_prerelease }} + + build-image: + needs: compute-suffix + uses: ./.github/workflows/build-container-image.yml + with: + branch: stable-4.3 + file_to_build: Dockerfile + platforms: linux/amd64,linux/arm64 + use_native_arm64_builder: true + cache: false + push_to_images: | + tootsuite/mastodon + ghcr.io/mastodon/mastodon + version_prerelease: ${{ needs.compute-suffix.outputs.prerelease }} + labels: | + org.opencontainers.image.description=Nightly build image used for testing purposes + flavor: | + latest=false + tags: | + type=raw,value=4.3-nightly + type=schedule,pattern=${{ needs.compute-suffix.outputs.prerelease }} + secrets: inherit + + build-image-streaming: + needs: compute-suffix + uses: ./.github/workflows/build-container-image.yml + with: + branch: stable-4.3 + file_to_build: streaming/Dockerfile + platforms: linux/amd64,linux/arm64 + use_native_arm64_builder: true + cache: false + push_to_images: | + tootsuite/mastodon-streaming + ghcr.io/mastodon/mastodon-streaming + version_prerelease: ${{ needs.compute-suffix.outputs.prerelease }} + labels: | + org.opencontainers.image.description=Nightly build image used for testing purposes + flavor: | + latest=false + tags: | + type=raw,value=4.3-nightly + type=schedule,pattern=${{ needs.compute-suffix.outputs.prerelease }} + secrets: inherit