mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-10-20 10:21:11 +00:00
Every action pinned to a node16/node20 major is bumped to its current node24 major, clearing the "Node 20 is being deprecated" warnings. Verified each action's runs.using upstream rather than assuming, and checked release notes for breaking changes. All bumps are version-string only; no call site needed an input change: - download-artifact v5 path change affects artifact-ids only (we use name/pattern) - dawidd6 v21 only adds inputs; all five we pass are unchanged - gh-release v1->v3 is runtime-only (no input renames) - buildx v4 config:/install: renames unused; build-push v7 removed env vars unused; get-previous-tag v2 prefix: removal unused - github-script v8 is runtime-only (v9's getOctokit break avoided) actionlint findings: 13 -> 4. All 9 runtime findings cleared; the 4 remaining are pre-existing expression warnings, left untouched. Not bumped (no node24 release exists upstream): markdown-to-output, toml-action, gh-truncate-string-action, discord-webhook.
235 lines
6.8 KiB
YAML
235 lines
6.8 KiB
YAML
name: Build Develop
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
|
|
env:
|
|
MIX_ENV: prod
|
|
GH_TOKEN: ${{ github.token }}
|
|
REGISTRY_IMAGE: wandererltd/community-edition
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: 🛠 Build
|
|
runs-on: ubuntu-22.04
|
|
if: ${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
|
|
permissions:
|
|
checks: write
|
|
contents: write
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
pull-requests: write
|
|
repository-projects: write
|
|
strategy:
|
|
matrix:
|
|
otp: ["27"]
|
|
elixir: ["1.17"]
|
|
node-version: ["18.x"]
|
|
outputs:
|
|
commit_hash: ${{ steps.set-commit-develop.outputs.commit_hash }}
|
|
steps:
|
|
- name: Prepare
|
|
run: |
|
|
platform=${{ matrix.platform }}
|
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
|
|
- name: Setup Elixir
|
|
uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{matrix.otp}}
|
|
elixir-version: ${{matrix.elixir}}
|
|
# nix build would also work here because `todos` is the default package
|
|
- name: ⬇️ Checkout repo
|
|
uses: actions/checkout@v5
|
|
with:
|
|
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
|
fetch-depth: 0
|
|
- name: 😅 Cache deps
|
|
id: cache-deps
|
|
uses: actions/cache@v5
|
|
env:
|
|
cache-name: cache-elixir-deps
|
|
with:
|
|
path: |
|
|
deps
|
|
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-
|
|
- name: 😅 Cache compiled build
|
|
id: cache-build
|
|
uses: actions/cache@v5
|
|
env:
|
|
cache-name: cache-compiled-build
|
|
with:
|
|
path: |
|
|
_build
|
|
key: ${{ runner.os }}-build-${{ hashFiles('**/mix.lock') }}-${{ hashFiles( '**/lib/**/*.{ex,eex}', '**/config/*.exs', '**/mix.exs' ) }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ hashFiles('**/mix.lock') }}-
|
|
${{ runner.os }}-build-
|
|
# Step: Download project dependencies. If unchanged, uses
|
|
# the cached version.
|
|
- name: 🌐 Install dependencies
|
|
run: mix deps.get --only "prod"
|
|
|
|
# Step: Compile the project treating any warnings as errors.
|
|
# Customize this step if a different behavior is desired.
|
|
- name: 🛠 Compiles without warnings
|
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
run: mix compile
|
|
|
|
- name: Set commit hash for develop
|
|
id: set-commit-develop
|
|
run: |
|
|
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
docker:
|
|
name: 🛠 Build Docker Images
|
|
needs: build
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
checks: write
|
|
contents: write
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
pull-requests: write
|
|
repository-projects: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- linux/amd64
|
|
- linux/arm64
|
|
steps:
|
|
- name: Prepare
|
|
run: |
|
|
platform=${{ matrix.platform }}
|
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
|
|
- name: ⬇️ Checkout repo
|
|
uses: actions/checkout@v5
|
|
with:
|
|
ref: ${{ needs.build.outputs.commit_hash }}
|
|
fetch-depth: 0
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.WANDERER_DOCKER_USER }}
|
|
password: ${{ secrets.WANDERER_DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
id: build
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
push: true
|
|
context: .
|
|
file: ./Dockerfile
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: ${{ matrix.platform }}
|
|
outputs: type=image,"name=${{ env.REGISTRY_IMAGE }}",push-by-digest=true,name-canonical=true,push=true
|
|
build-args: |
|
|
MIX_ENV=prod
|
|
BUILD_METADATA=${{ steps.meta.outputs.json }}
|
|
|
|
- name: Export digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
- name: Upload digest
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: digests-${{ env.PLATFORM_PAIR }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- docker
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: digests-*
|
|
merge-multiple: true
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.WANDERER_DOCKER_USER }}
|
|
password: ${{ secrets.WANDERER_DOCKER_PASSWORD }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY_IMAGE }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }}
|
|
type=raw,value=develop-{{sha}},enable=${{ github.ref == 'refs/heads/develop' }}
|
|
|
|
- name: Create manifest list and push
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
|
|
|
- name: Inspect image
|
|
run: |
|
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
|
|
|
notify:
|
|
name: 🏷 Notify about develop release
|
|
runs-on: ubuntu-22.04
|
|
needs: [docker, merge]
|
|
steps:
|
|
- name: Discord Webhook Action
|
|
uses: tsickert/discord-webhook@v5.3.0
|
|
with:
|
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL_DEV }}
|
|
content: |
|
|
📣 New develop release available 🚀
|
|
|
|
**Commit**: `${{ github.sha }}`
|
|
**Status**: Development/Testing Release
|
|
|
|
Docker image: `wandererltd/community-edition:develop`
|
|
|
|
⚠️ This is an unstable development release for testing purposes.
|