This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Arkctl Release Action #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Arkctl Release Action | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'version of current arkctl' | |
required: true | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
prepare: | |
name: Prepare for build | |
runs-on: ubuntu-latest | |
outputs: | |
is-tag-created: ${{ steps.check_tag.outputs.exists }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if Tag Exists | |
id: check_tag | |
run: | | |
TAG_EXISTS=$(git tag -l "arkctl-release-${{ github.event.inputs.version }}") | |
if [ -z "$TAG_EXISTS" ]; then | |
echo "exists=False" >> $GITHUB_OUTPUT | |
else | |
echo "exists=True" >> $GITHUB_OUTPUT | |
fi | |
create-tag: | |
name: Create for branch if empty | |
if: needs.prepare.outputs.created-tag == 'False' | |
runs-on: ubuntu-latest | |
needs: ['prepare'] | |
steps: | |
- name: Output variable | |
run: echo "Created Branch ${{needs.prepare.outputs.is-tag-created}} ?" | |
- uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ACTIONS_RUNNER_DEBUG: true | |
with: | |
tag_name: arkctl-release-${{ github.event.inputs.version }} | |
release_name: Release arkctl ${{ github.event.inputs.version }} binary! | |
release: | |
name: Release binary | |
runs-on: ubuntu-latest | |
if: always() | |
needs: ['prepare', 'create-tag'] | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: ["386", amd64, arm64] | |
exclude: | |
- goarch: "386" | |
goos: darwin | |
- goarch: arm64 | |
goos: windows | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wangyoucao577/go-release-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.goarch }} | |
goversion: "1.21.3" | |
project_path: "./arkctl" | |
binary_name: "arkctl" | |
asset_name: "arkctl-${{ github.event.inputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}" | |
release_tag: "arkctl-release-${{ github.event.inputs.version }}" |