fix: zip artifacts #47
Workflow file for this run
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: Lint, build and upload Igitt | |
on: | |
push: | |
# branches: ["main"] | |
tags: | |
- "*" | |
pull_request: | |
branches: ["main"] | |
jobs: | |
lint: | |
# run on self-hosted runner to reduce usage quota | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Lint | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
golangci-lint run | |
test: | |
needs: lint | |
# run on github hosted runner to avoid waste of resources | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Test | |
run: go test -v ./... | |
buildStatusCheck: | |
if: github.event_name == 'pull_request' | |
runs-on: self-hosted | |
needs: [lint, test] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Build | |
run: | | |
go build -o /dev/null ./cmd/igitt; | |
build: | |
needs: [lint, test] | |
if: startsWith(github.ref, 'refs/tags/') | |
# run on self-hosted runner to reduce usage quota | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Set GOOS and GOARCH | |
run: | | |
echo "GOOS=${{ matrix.goos }}" >> $GITHUB_ENV | |
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV | |
- name: Get latest tag and short commit SHA | |
run: | | |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
echo "SHORT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
if [[ "${{ matrix.goos }}" == "windows" ]]; then \ | |
go build -v -o out/igitt.exe ./cmd/igitt; \ | |
else \ | |
go build -v -o out/igitt ./cmd/igitt; \ | |
fi | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: igitt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.LATEST_TAG }} | |
path: | | |
out/igitt* | |
pre-release: | |
permissions: | |
contents: write | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: igitt-* | |
- name: Create ZIP Archives | |
run: | | |
for dir in igitt-*; do | |
zip -r "${dir}.zip" "$dir" | |
done | |
- name: debug-tree | |
run: | | |
tree | |
- name: Release on GitHub | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
igitt-* | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: "Automatic Pre-Release: ${{ github.ref_name }}" | |
body: | | |
This is an automatic pre-release build. | |
draft: false | |
prerelease: true |