Skip to content

Commit bac3176

Browse files
committed
chore: fix action
1 parent 5c60fad commit bac3176

File tree

2 files changed

+56
-66
lines changed

2 files changed

+56
-66
lines changed

.github/workflows/airbox-release.yml

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,61 @@ permissions:
1313
contents: write
1414

1515
jobs:
16-
create-release:
17-
name: Build and publish airbox release
16+
release:
1817
runs-on: ubuntu-latest
1918
steps:
20-
- name: Validate tag
21-
run: |
22-
if [[ ! "${{ inputs.tag_name }}" =~ ^airbox-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23-
echo "tag is invalid: must be in the form 'airbox-v0.0.0'"
24-
exit 1
25-
fi
26-
- name: Create tag
27-
uses: actions/github-script@v5
28-
with:
29-
script: |
30-
github.rest.git.createRef({
31-
owner: context.repo.owner,
32-
repo: context.repo.repo,
33-
ref: 'refs/tags/${{ inputs.tag_name }}',
34-
sha: context.sha
35-
})
36-
- uses: actions/checkout@v4
37-
with:
38-
fetch-depth: 0
39-
- uses: actions/setup-go@v5
40-
with:
41-
go-version: 'stable'
42-
43-
- name: Run GoReleaser for Airbox
44-
uses: goreleaser/goreleaser-action@v6
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.github_token }}
47-
with:
48-
distribution: goreleaser
49-
version: "~> v2"
50-
args: release --config .goreleaser-airbox.yaml --clean
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v6
23+
with:
24+
go-version: '1.24'
25+
26+
- name: Get version from tag
27+
id: version
28+
run: |
29+
TAG_NAME="${{ inputs.tag_name }}"
30+
VERSION=${TAG_NAME#airbox-}
31+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
32+
echo "FULL_TAG=$TAG_NAME" >> $GITHUB_OUTPUT
33+
if [[ "$VERSION" =~ (beta|rc|alpha) ]]; then
34+
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
35+
else
36+
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Build binaries
40+
run: |
41+
GOOS=linux GOARCH=amd64 go build -o ./dist/airbox-linux-amd64 ./cmd/airbox
42+
GOOS=linux GOARCH=arm64 go build -o ./dist/airbox-linux-arm64 ./cmd/airbox
43+
GOOS=darwin GOARCH=amd64 go build -o ./dist/airbox-darwin-amd64 ./cmd/airbox
44+
GOOS=darwin GOARCH=arm64 go build -o ./dist/airbox-darwin-arm64 ./cmd/airbox
45+
GOOS=windows GOARCH=amd64 go build -o ./dist/airbox-windows-amd64.exe ./cmd/airbox
46+
47+
cd ./dist
48+
tar -czf airbox-linux-amd64.tar.gz airbox-linux-amd64
49+
tar -czf airbox-linux-arm64.tar.gz airbox-linux-arm64
50+
tar -czf airbox-darwin-amd64.tar.gz airbox-darwin-amd64
51+
tar -czf airbox-darwin-arm64.tar.gz airbox-darwin-arm64
52+
zip airbox-windows-amd64.zip airbox-windows-amd64.exe
53+
54+
- name: Create Tag
55+
run: |
56+
git config user.name github-actions
57+
git config user.email github-actions@github.com
58+
git tag ${{ inputs.tag_name }}
59+
git push origin ${{ inputs.tag_name }}
60+
61+
- name: Create Release
62+
uses: softprops/action-gh-release@v1
63+
with:
64+
tag_name: ${{ inputs.tag_name }}
65+
name: Airbox ${{ steps.version.outputs.VERSION }}
66+
body: Airbox ${{ steps.version.outputs.VERSION }}
67+
files: |
68+
dist/*.tar.gz
69+
dist/*.zip
70+
draft: false
71+
prerelease: ${{ steps.version.outputs.PRERELEASE }}
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser-airbox.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)