Skip to content

link releases to Announcements discussions #69

link releases to Announcements discussions

link releases to Announcements discussions #69

Workflow file for this run

name: Release
on:
push:
branches: [main]
tags: ["v*"]
permissions:
contents: write
packages: write
discussions: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: deployah/deployah
# 'latest' only on stable tags (no pre-release suffix like -alpha, -beta, -rc)
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }}
type=edge,branch=${{ github.event.repository.default_branch }}
flavor: |
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 10
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set version
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: docker/bake-action@v7
with:
targets: artifact
provenance: false
set: |
artifact.cache-from=type=gha,scope=artifact
artifact.cache-to=type=gha,mode=max,scope=artifact
- name: Move artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
find ./dist -type f -not -name "SHA256SUMS" -exec mv {} ./dist/ \;
find ./dist -name "SHA256SUMS" -exec cat {} \; | sort -u > ./dist/SHA256SUMS.combined
mv ./dist/SHA256SUMS.combined ./dist/SHA256SUMS
find ./dist -type d -empty -delete
- name: Upload artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v7
with:
name: deployah-artifacts
path: ./dist/*
if-no-files-found: error
- name: Build and push image
uses: docker/bake-action@v7
with:
targets: image
push: true
sbom: true
provenance: true
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
set: |
image.cache-from=type=gha,scope=image
image.cache-to=type=gha,mode=max,scope=image
- name: Sync Docker Hub description
uses: peter-evans/dockerhub-description@v5
if: github.ref_name == github.event.repository.default_branch
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: deployah/deployah
short-description: ${{ github.event.repository.description }}
- name: GitHub Release
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
discussion_category_name: Announcements
# TODO: add dist/*.zip once windows targets are enabled.
files: |
dist/*.tar.gz
dist/*.sha256sum
dist/SHA256SUMS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}