* chore: release v0.18.5 * update changelog --------- Co-authored-by: Flomp <26000991+Flomp@users.noreply.github.com> Co-authored-by: Christian Beutel <>
89 lines
2.9 KiB
YAML
89 lines
2.9 KiB
YAML
name: Publish Release
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [main]
|
|
|
|
jobs:
|
|
# Only run if the PR was merged AND it came from a release branch
|
|
publish:
|
|
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.version }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Version Output
|
|
id: get_version
|
|
run: |
|
|
# Extract v0.12.0 from release/v0.12.0
|
|
VERSION_TAG=${GITHUB_HEAD_REF#release/}
|
|
echo "version=$VERSION_TAG" >> $GITHUB_OUTPUT
|
|
|
|
# Git Tagging
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag $VERSION_TAG
|
|
git push origin $VERSION_TAG
|
|
|
|
docker-build:
|
|
needs: publish
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker Images
|
|
env:
|
|
VERSION: ${{ needs.publish.outputs.version }}
|
|
run: |
|
|
docker buildx build db/ --no-cache -t flomp/wanderer-db:$VERSION -t flomp/wanderer-db:latest --platform=linux/amd64,linux/arm64 --push
|
|
docker buildx build web/ --no-cache -t flomp/wanderer-web:$VERSION -t flomp/wanderer-web:latest --platform=linux/amd64,linux/arm64 --push
|
|
cd docs && npm ci && npm run build && cd ..
|
|
docker buildx build docs/ --no-cache -t flomp/wanderer-docs:$VERSION -t flomp/wanderer-docs:latest --platform=linux/amd64,linux/arm64 --push
|
|
|
|
release:
|
|
needs: [publish, docker-build]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Extract release notes
|
|
id: changelog
|
|
run: |
|
|
VERSION="${{ needs.publish.outputs.version }}"
|
|
# Clean 'v' from v0.12.0 for awk if your changelog uses 0.12.0
|
|
RAW_VER=${VERSION#v}
|
|
CHANGELOG=$(awk -v ver="$RAW_VER" 'BEGIN {in_section=0} /^# / {if (in_section) exit; if ($2 == ver) in_section=1} in_section {print}' CHANGELOG.md)
|
|
echo 'changelog<<EOF' >> $GITHUB_OUTPUT
|
|
printf "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.publish.outputs.version }}
|
|
body: ${{ steps.changelog.outputs.changelog }}
|
|
draft: false
|
|
prerelease: false |