whoops #759
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
get-upstream-versions: | |
# This is a bit yucky - it feels like it should be possible to do this with a matrix. | |
runs-on: ${{ matrix.arch.os }} | |
outputs: | |
stable_version: ${{steps.version-stable.outputs.version}} | |
stable_semver_major: ${{steps.version-stable.outputs.semver_major}} | |
stable_semver_minor: ${{steps.version-stable.outputs.semver_minor}} | |
stable_semver_patch: ${{steps.version-stable.outputs.semver_patch}} | |
testing_version: ${{steps.version-testing.outputs.version}} | |
testing_semver_major: ${{steps.version-testing.outputs.semver_major}} | |
testing_semver_minor: ${{steps.version-testing.outputs.semver_minor}} | |
testing_semver_patch: ${{steps.version-testing.outputs.semver_patch}} | |
steps: | |
- name: Discover upstream stable version | |
uses: ropenttd/cdn_version_scraper@master | |
with: | |
channel: stable | |
id: version-stable | |
- name: Discover upstream testing version | |
uses: ropenttd/cdn_version_scraper@master | |
with: | |
channel: testing | |
id: version-testing | |
cri: | |
needs: | |
- get-upstream-versions | |
strategy: | |
matrix: | |
train: | |
- stable | |
- testing | |
arch: | |
- os: ubuntu-24.04 | |
name: linux/amd64 | |
label: linux-amd64 | |
- os: ubuntu-24.04-arm | |
name: linux/arm64 | |
label: linux-arm64 | |
runs-on: ${{ matrix.arch.os }} | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Set target version environment variables | |
# Again, this is ewwy. | |
if: matrix.train == 'stable' | |
run: | | |
echo version=${{needs.get-upstream-versions.outputs.stable_version}} >> $GITHUB_ENV | |
echo semver_major=${{needs.get-upstream-versions.outputs.stable_semver_major}} >> $GITHUB_ENV | |
echo semver_minor=${{needs.get-upstream-versions.outputs.stable_semver_minor}} >> $GITHUB_ENV | |
echo semver_patch=${{needs.get-upstream-versions.outputs.stable_semver_patch}} >> $GITHUB_ENV | |
- name: Set target version environment variables (testing) | |
# Again, this is ewwy. | |
if: matrix.train == 'testing' | |
run: | | |
echo version=${{needs.get-upstream-versions.outputs.testing_version}} >> $GITHUB_ENV | |
echo semver_major=${{needs.get-upstream-versions.outputs.testing_semver_major}} >> $GITHUB_ENV | |
echo semver_minor=${{needs.get-upstream-versions.outputs.testing_semver_minor}} >> $GITHUB_ENV | |
echo semver_patch=${{needs.get-upstream-versions.outputs.testing_semver_patch}} >> $GITHUB_ENV | |
- name: Generate CRI metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/openttd | |
docker.io/redditopenttd/openttd | |
labels: | | |
org.opencontainers.image.title=OpenTTD | |
org.opencontainers.image.description=Lightweight build of OpenTTD, designed for server use, with some extra helping treats. | |
org.opencontainers.image.url=https://github.com/ropenttd/docker_openttd | |
org.opencontainers.image.source=https://github.com/openttd/openttd | |
org.opencontainers.image.vendor=Reddit OpenTTD | |
org.opencontainers.image.version=${{ env.version }} | |
tags: | | |
${{ env.version }}-${{ matrix.arch.label }} | |
- name: Set up Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCI | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./Dockerfile | |
build-args: | | |
OPENTTD_VERSION=${{ env.version }} | |
platforms: ${{ matrix.arch.name }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
provenance: false | |
release-bundle-manifest: | |
needs: | |
- get-upstream-versions | |
- cri | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
train: | |
- stable | |
- testing | |
container_store: | |
- docker | |
- ghcr | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set target version environment variables | |
# Again, this is ewwy. | |
if: matrix.train == 'stable' | |
run: | | |
echo version=${{needs.get-upstream-versions.outputs.stable_version}} >> $GITHUB_ENV | |
echo semver_major=${{needs.get-upstream-versions.outputs.stable_semver_major}} >> $GITHUB_ENV | |
echo semver_minor=${{needs.get-upstream-versions.outputs.stable_semver_minor}} >> $GITHUB_ENV | |
echo semver_patch=${{needs.get-upstream-versions.outputs.stable_semver_patch}} >> $GITHUB_ENV | |
- name: Set target version environment variables (testing) | |
# Again, this is ewwy. | |
if: matrix.train == 'testing' | |
run: | | |
echo version=${{needs.get-upstream-versions.outputs.testing_version}} >> $GITHUB_ENV | |
echo semver_major=${{needs.get-upstream-versions.outputs.testing_semver_major}} >> $GITHUB_ENV | |
echo semver_minor=${{needs.get-upstream-versions.outputs.testing_semver_minor}} >> $GITHUB_ENV | |
echo semver_patch=${{needs.get-upstream-versions.outputs.testing_semver_patch}} >> $GITHUB_ENV | |
- name: Create and push manifest (GHCR, stable) | |
uses: Noelware/docker-manifest-action@0.4.2 | |
if: matrix.train == 'stable' && matrix.container_store == 'ghcr' | |
with: | |
inputs: ${{env.GHCR_REPO}}:latest,${{env.GHCR_REPO}}:stable,${{env.GHCR_REPO}}:${{env.version}},${{env.GHCR_REPO}}:${{env.semver_major}} | |
images: ${{env.GHCR_REPO}}:${{env.version}}-linux-amd64,${{env.GHCR_REPO}}:${{env.version}}-linux-arm64 | |
push: true | |
- name: Create and push manifest (GHCR, testing) | |
uses: Noelware/docker-manifest-action@0.4.2 | |
if: matrix.train == 'testing' && matrix.container_store == 'ghcr' | |
with: | |
inputs: ${{env.GHCR_REPO}}:testing,${{env.GHCR_REPO}}:${{env.version}} | |
images: ${{env.GHCR_REPO}}:${{env.version}}-linux-amd64,${{env.GHCR_REPO}}:${{env.version}}-linux-arm64 | |
push: true | |
- name: Create and push manifest (Docker, stable) | |
uses: Noelware/docker-manifest-action@0.4.2 | |
if: matrix.train == 'stable' && matrix.container_store == 'docker' | |
with: | |
inputs: ${{env.DOCKER_REPO}}:latest,${{env.DOCKER_REPO}}:stable,${{env.DOCKER_REPO}}:${{env.version}},${{env.DOCKER_REPO}}:${{ env.semver_major }} | |
images: ${{env.DOCKER_REPO}}:${{env.version}}-linux-amd64,${{env.DOCKER_REPO}}:${{env.version}}-linux-arm64 | |
push: true | |
- name: Create and push manifest (Docker, testing) | |
uses: Noelware/docker-manifest-action@0.4.2 | |
if: matrix.train == 'testing' && matrix.container_store == 'docker' | |
with: | |
inputs: ${{env.DOCKER_REPO}}:testing,${{env.DOCKER_REPO}}:${{env.version}} | |
images: ${{env.DOCKER_REPO}}:${{env.version}}-linux-amd64,${{env.DOCKER_REPO}}:${{env.version}}-linux-arm64 | |
push: true |