Skip to content

Github Release

Github Release #39

name: "Github Release"
permissions:
contents: "write"
on:
workflow_run:
workflows: ["Github Tag"]
types: [completed]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# name of image
IMAGE: docker-autoheal
# github.repository as <account>/<repo>
IMAGE_NAME: tmknight/docker-autoheal
# Build args
CONTEXT: .
DISTRO: alpine
RELEASE: stable
jobs:
get-version:
uses: ./.github/workflows/get-version.yml
create-release:
name: "Create release"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs: "get-version"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Create draft release"
uses: "taiki-e/create-gh-release-action@v1"
with:
# (optional) Path to changelog.
changelog: CHANGELOG.md
branch: "main"
ref: refs/tags/${{ needs.get-version.outputs.pkg-version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
upload-assets:
name: "Upload assets"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- "get-version"
- "create-release"
strategy:
matrix:
include:
- target: "x86_64-unknown-linux-gnu"
os: "ubuntu-latest"
- target: "x86_64-unknown-linux-musl"
os: "ubuntu-latest"
- target: "aarch64-unknown-linux-gnu"
os: "ubuntu-latest"
- target: "aarch64-unknown-linux-musl"
os: "ubuntu-latest"
# - target: "aarch64-unknown-openbsd"
# os: "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Upload assets"
uses: "taiki-e/upload-rust-binary-action@v1"
with:
bin: ${{ env.IMAGE }}
target: ${{ matrix.target }}
archive: $bin-${{ matrix.target }}
ref: refs/tags/${{ needs.get-version.outputs.pkg-version }}
token: ${{ secrets.GITHUB_TOKEN }}
publish-release:
name: "Publish release"
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- "get-version"
- "upload-assets"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Release draft"
run: gh release edit ${{ needs.get-version.outputs.pkg-version }} --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}