mirror of
https://github.com/bybrooklyn/alchemist.git
synced 2026-04-18 01:43:34 -04:00
94 lines
2.8 KiB
YAML
94 lines
2.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: release-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
|
|
jobs:
|
|
release-meta:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
prerelease: ${{ steps.channel.outputs.prerelease }}
|
|
make_latest: ${{ steps.channel.outputs.make_latest }}
|
|
docker_tags: ${{ steps.docker.outputs.tags }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Read VERSION
|
|
id: version
|
|
run: echo "version=$(tr -d '\n\r' < VERSION)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Validate tag matches VERSION
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
expected="v${{ steps.version.outputs.version }}"
|
|
if [[ "${GITHUB_REF_NAME}" != "${expected}" ]]; then
|
|
echo "Tag ${GITHUB_REF_NAME} does not match VERSION ${expected}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Determine release channel
|
|
id: channel
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ "${GITHUB_REF_NAME}" == *-rc.* ||
|
|
"${GITHUB_REF_NAME}" == *-beta.* ||
|
|
"${GITHUB_REF_NAME}" == *-alpha.* ]]; then
|
|
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
|
echo "make_latest=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
|
echo "make_latest=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Compute Docker tags
|
|
id: docker
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
TAGS="ghcr.io/bybrooklyn/alchemist:${VERSION}"
|
|
if [[ "${{ steps.channel.outputs.prerelease }}" == "false" ]]; then
|
|
TAGS="${TAGS}"$'\n'"ghcr.io/bybrooklyn/alchemist:latest"
|
|
fi
|
|
{
|
|
echo "tags<<EOF"
|
|
echo "${TAGS}"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
build:
|
|
needs: [release-meta]
|
|
uses: ./.github/workflows/build.yml
|
|
with:
|
|
version_suffix: ""
|
|
push_docker: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
docker_tags: ${{ needs.release-meta.outputs.docker_tags }}
|
|
publish_release: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
release_tag: ${{ github.ref_name }}
|
|
release_name: >-
|
|
Alchemist ${{ needs.release-meta.outputs.version }}
|
|
prerelease: ${{ needs.release-meta.outputs.prerelease == 'true' }}
|
|
make_latest: ${{ needs.release-meta.outputs.make_latest == 'true' }}
|