fix: add new action
R
Rüdiger Küpper
<rpr@9it.de>
committete am 19.02.2026 07:43
32ec005e3c167d19fa95c5fa4f9d6a06b3d740d6
| @@ -0,0 +1,120 @@ | ||
| 1 | +name: Build and Release |
|
| 2 | + | |
| 3 | +on: |
|
| 4 | +push: |
|
| 5 | +tags: |
|
| 6 | +- 'v*' |
|
| 7 | +workflow_dispatch: |
|
| 8 | +inputs: |
|
| 9 | +tag: |
|
| 10 | +description: 'Release tag (e.g. v1.2.3)' |
|
| 11 | +required: true |
|
| 12 | + | |
| 13 | +permissions: |
|
| 14 | +contents: write |
|
| 15 | + | |
| 16 | +env: |
|
| 17 | +BINARY_NAME: quilldrop |
|
| 18 | + | |
| 19 | +jobs: |
|
| 20 | +build: |
|
| 21 | +runs-on: ubuntu-latest |
|
| 22 | +strategy: |
|
| 23 | +fail-fast: false |
|
| 24 | +matrix: |
|
| 25 | +include: |
|
| 26 | +- goos: linux |
|
| 27 | +goarch: amd64 |
|
| 28 | +- goos: linux |
|
| 29 | +goarch: arm64 |
|
| 30 | +- goos: darwin |
|
| 31 | +goarch: amd64 |
|
| 32 | +- goos: darwin |
|
| 33 | +goarch: arm64 |
|
| 34 | +- goos: windows |
|
| 35 | +goarch: arm64 |
|
| 36 | + | |
| 37 | +steps: |
|
| 38 | +- name: Checkout |
|
| 39 | +uses: actions/checkout@v4 |
|
| 40 | + | |
| 41 | +- name: Setup Go |
|
| 42 | +uses: actions/setup-go@v5 |
|
| 43 | +with: |
|
| 44 | +go-version-file: go.mod |
|
| 45 | +cache: true |
|
| 46 | + | |
| 47 | +- name: Build static binary |
|
| 48 | +env: |
|
| 49 | + GOOS: ${{ matrix.goos }} |
|
| 50 | + GOARCH: ${{ matrix.goarch }} |
|
| 51 | +CGO_ENABLED: '0' |
|
| 52 | +run: | |
|
| 53 | +set -euo pipefail |
|
| 54 | + | |
| 55 | + BIN="${BINARY_NAME}-${GOOS}-${GOARCH}" |
|
| 56 | + if [ "${GOOS}" = "windows" ]; then |
|
| 57 | + BIN="${BIN}.exe" |
|
| 58 | +fi |
|
| 59 | + | |
| 60 | + go build -trimpath -ldflags="-s -w" -o "${BIN}" . |
|
| 61 | + | |
| 62 | +mkdir -p dist |
|
| 63 | + if [ "${GOOS}" = "windows" ]; then |
|
| 64 | + zip "dist/${BINARY_NAME}-${GOOS}-${GOARCH}.zip" "${BIN}" |
|
| 65 | +else |
|
| 66 | + tar -czf "dist/${BINARY_NAME}-${GOOS}-${GOARCH}.tar.gz" "${BIN}" |
|
| 67 | +fi |
|
| 68 | + | |
| 69 | +- name: Generate checksum |
|
| 70 | +run: | |
|
| 71 | +cd dist |
|
| 72 | + sha256sum * > checksums-${{ matrix.goos }}-${{ matrix.goarch }}.txt |
|
| 73 | + cat checksums-${{ matrix.goos }}-${{ matrix.goarch }}.txt |
|
| 74 | + | |
| 75 | +- name: Upload artifact |
|
| 76 | +uses: actions/upload-artifact@v4 |
|
| 77 | +with: |
|
| 78 | + name: ${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }} |
|
| 79 | +path: dist/* |
|
| 80 | +if-no-files-found: error |
|
| 81 | + | |
| 82 | +release: |
|
| 83 | +needs: build |
|
| 84 | +runs-on: ubuntu-latest |
|
| 85 | +steps: |
|
| 86 | +- name: Download all artifacts |
|
| 87 | +uses: actions/download-artifact@v4 |
|
| 88 | +with: |
|
| 89 | +path: artifacts |
|
| 90 | +merge-multiple: true |
|
| 91 | + | |
| 92 | +- name: Merge checksums |
|
| 93 | +run: | |
|
| 94 | +cd artifacts |
|
| 95 | +cat checksums-*.txt > checksums.txt |
|
| 96 | +rm checksums-*.txt |
|
| 97 | +echo "=== checksums.txt ===" |
|
| 98 | +cat checksums.txt |
|
| 99 | + | |
| 100 | +- name: Determine tag |
|
| 101 | +id: tag |
|
| 102 | +run: | |
|
| 103 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
|
| 104 | + echo "version=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" |
|
| 105 | +else |
|
| 106 | + echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" |
|
| 107 | +fi |
|
| 108 | + | |
| 109 | +- name: List release assets |
|
| 110 | +run: ls -la artifacts/ |
|
| 111 | + | |
| 112 | +- name: Create GitHub Release |
|
| 113 | +env: |
|
| 114 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
| 115 | +run: | |
|
| 116 | + gh release create "${{ steps.tag.outputs.version }}" \ |
|
| 117 | + --repo "${{ github.repository }}" \ |
|
| 118 | + --title "${{ steps.tag.outputs.version }}" \ |
|
| 119 | +--generate-notes \ |
|
| 120 | +artifacts/* |
| @@ -1,15 +1,15 @@ | ||
| 1 | 1 | name: build-and-release |
| 2 | 2 | |
| 3 | 3 | on: |
| 4 | -push: |
|
| 5 | -branches: [main] |
|
| 4 | +# push: |
|
| 5 | +# branches: [main] |
|
| 6 | 6 | workflow_dispatch: |
| 7 | 7 | # tags: |
| 8 | 8 | # - 'v*' # z.B. v1.2.3 |
| 9 | 9 | |
| 10 | 10 | permissions: |
| 11 | 11 | contents: write |
| 12 | 12 | packages: write |
| 13 | 13 | id-token: write |
| 14 | 14 | issues: write |
| 15 | 15 | pull-requests: write |
| @@ -64,32 +64,25 @@ jobs: | ||
| 64 | 64 | version_override: ${{ github.event.inputs.version || '' }} |
| 65 | 65 | default_version: 'dev' |
| 66 | 66 | |
| 67 | 67 | build: |
| 68 | 68 | runs-on: [ arc-runner-set ] |
| 69 | 69 | # runs-on: [ self-hosted ] |
| 70 | 70 | needs: [ "create-version-tag" ] |
| 71 | 71 | strategy: |
| 72 | 72 | fail-fast: false |
| 73 | 73 | matrix: |
| 74 | -# goos: [linux,] |
|
| 75 | -# goarch: [arm64] |
|
| 76 | -goos: [linux, darwin] |
|
| 74 | +goos: [linux, darwin, windows] |
|
| 77 | 75 | goarch: [amd64, arm64] |
| 78 | -# goos: [linux, darwin, windows] |
|
| 79 | -# goarch: [amd64, arm64,arm] |
|
| 80 | -# exclude: |
|
| 81 | -# # ARM 32-bit ist nur für Linux sinnvoll |
|
| 82 | -# - goos: darwin |
|
| 83 | -# goarch: arm |
|
| 84 | -# - goos: windows |
|
| 85 | -# goarch: arm |
|
| 76 | +exclude: |
|
| 77 | +- goos: windows |
|
| 78 | +goarch: amd64 |
|
| 86 | 79 | |
| 87 | 80 | steps: |
| 88 | 81 | - uses: actions/checkout@v6 |
| 89 | 82 | |
| 90 | 83 | - name: Setup Go |
| 91 | 84 | uses: actions/setup-go@v6 |
| 92 | 85 | with: |
| 93 | 86 | go-version: '1.25' |
| 94 | 87 | cache: true |
| 95 | 88 |