|
1 | | - |
2 | | -name: Build release |
3 | | -on: push |
4 | | - |
5 | | -env: |
6 | | - PRE_PATH: "" |
7 | | - |
8 | | -permissions: |
9 | | - contents: write |
| 1 | +name: Publish New Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*.*.*' |
10 | 6 |
|
11 | 7 | jobs: |
12 | | - goreleaser: |
| 8 | + releases-matrix: |
| 9 | + name: Release Go Binary |
13 | 10 | runs-on: ubuntu-latest |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + goos: [linux] |
| 14 | + goarch: [amd64] |
14 | 15 | steps: |
15 | | - - |
16 | | - name: Checkout |
17 | | - uses: actions/checkout@v4 |
18 | | - with: |
19 | | - fetch-depth: 0 |
20 | | - - |
21 | | - name: Set up Go |
22 | | - uses: actions/setup-go@v5 |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - uses: actions/setup-go@v5 |
23 | 18 | with: |
24 | 19 | go-version: '^1.22' |
25 | 20 |
|
26 | 21 | - name: Set APP_VERSION |
27 | 22 | id: set_version |
28 | 23 | run: echo "APP_VERSION=$(sh setversion.sh)" >> $GITHUB_ENV |
29 | 24 |
|
30 | | - - name: Run GoReleaser |
31 | | - uses: goreleaser/goreleaser-action@v6 |
32 | | - with: |
33 | | - distribution: goreleaser |
34 | | - version: latest |
35 | | - args: release --clean --skip validate |
| 25 | + - name: make dist |
| 26 | + run: mkdir -p dist |
| 27 | + |
| 28 | + - name: build |
| 29 | + run: go build -ldflags "-s -w -X main.version=${APP_VERSION}" -o dist/ ./... |
36 | 30 | env: |
37 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
38 | | - GOPRIVATE: "github.com/codio/*" |
39 | | - APP_VERSION: ${{ env.APP_VERSION }} |
40 | | - GORELEASER_CURRENT_TAG: ${{ env.APP_VERSION }} |
| 31 | + CGO_ENABLED: 0 |
| 32 | + GOOS: ${{ matrix.goos }} |
| 33 | + GOARCH: ${{ matrix.goarch }} |
| 34 | + |
| 35 | + - name: additional items |
| 36 | + run: cp README.md dist/ |
41 | 37 |
|
42 | 38 | - name: Tar Folder |
| 39 | + if: ${{ matrix.goos != 'windows'}} |
43 | 40 | run: tar czf ../release.tgz ./ |
44 | 41 | working-directory: dist |
45 | 42 |
|
| 43 | + |
46 | 44 | - name: Upload To Artifactory |
| 45 | + if: ${{ matrix.goos != 'windows'}} |
47 | 46 | run: curl --fail -i -u"${BINARY_REPOSITORY_CREDENTIALS}" -T release.tgz "${BINARY_REPOSITORY_URL}/component-builds/govnc-${GIT_HASH}.tar.gz" |
48 | 47 | env: |
49 | 48 | BINARY_REPOSITORY_URL: ${{ secrets.BINARY_REPOSITORY_URL }} |
50 | 49 | GIT_HASH: ${{ github.sha }} |
51 | 50 | BINARY_REPOSITORY_CREDENTIALS: ${{ secrets.BINARY_REPOSITORY_USER }}:${{ secrets.BINARY_REPOSITORY_PASSWORD }} |
| 51 | + |
| 52 | + - name: Upload release assets |
| 53 | + uses: actions/upload-release-asset@v1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + with: |
| 57 | + upload_url: ${{ github.event.release.upload_url }} |
| 58 | + asset_name: govnc-${{ matrix.goos }}-${{ matrix.goarch }}.${{ matrix.goos == 'windows' && 'zip' || 'tgz' }} |
| 59 | + asset_path: ${{ matrix.goos == 'windows' && 'release.zip' || 'release.tgz' }} |
| 60 | + asset_content_type: application/octet-stream |
0 commit comments