Skip to content

Create Release

Create Release #24

name: Create Release
on:
workflow_dispatch:
inputs:
draft:
type: choice
description: "Create the release as draft"
options:
- "yes"
- "no"
default: "no"
required: true
force:
type: choice
description: "Force the creation of a release (even if no PR are found)"
options:
- "yes"
- "no"
default: "no"
required: true
jobs:
release:
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
pull-requests: read
outputs:
tag: ${{ steps.output.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we need this because fetch-tags=true and because of a GHA bug: https://github.com/actions/checkout/issues/1471
fetch-tags: true
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- id: create-release
uses: fabien-marty/github-create-next-semantic-release-action@main
with:
github-token: ${{ github.token }} # Let's use the default value of the current workflow
repository: ${{ github.repository }} # Let's use the default value of the current workflow
repository-owner: ${{ github.repository_owner }} # Let's use the default value of the current workflow
release-force: ${{ github.event.inputs.force == 'yes' }}
release-draft: ${{ github.event.inputs.draft == 'yes' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set output
id: output
run: |
echo "tag=${{ steps.create-release.outputs.new-tag}}" >>"$GITHUB_OUTPUT"
release_go_binary:
needs: release
name: Release Go Binary
runs-on: ubuntu-22.04
if: ${{ github.event.inputs.draft == 'no' }}
permissions:
contents: write
packages: write
pull-requests: read
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v4
- name: Debug
run: |
echo "tag=${{ needs.release.outputs.tag }}"
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./cmd/github-create-next-semantic-release
binary_name: github-create-next-semantic-release
compress_assets: "OFF"
pre_command: export CGO_ENABLED=0
release_tag: ${{ needs.release.outputs.tag }}
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./cmd/github-next-semantic-version
binary_name: github-next-semantic-version
compress_assets: "OFF"
pre_command: export CGO_ENABLED=0
release_tag: ${{ needs.release.outputs.tag }}