Skip to content

Commit aa2febc

Browse files
wip
1 parent 8785f60 commit aa2febc

2 files changed

Lines changed: 61 additions & 28 deletions

File tree

.github/workflows/createtag.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: createtag.yml
2+
on: push
3+
4+
jobs:
5+
create_tag:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Set APP_VERSION
14+
id: set_version
15+
run: echo "APP_VERSION=$(sh setversion.sh)" >> $GITHUB_ENV
16+
17+
- name: Create Tag
18+
run: |
19+
git config --global user.name 'github-actions[bot]'
20+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
21+
git tag ${{ env.APP_VERSION }} ${{ github.sha }} -m "Release ${{ env.APP_VERSION }}"
22+
git push origin ${{ env.APP_VERSION }}
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,60 @@
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*.*.*'
106

117
jobs:
12-
goreleaser:
8+
releases-matrix:
9+
name: Release Go Binary
1310
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
goos: [linux]
14+
goarch: [amd64]
1415
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
2318
with:
2419
go-version: '^1.22'
2520

2621
- name: Set APP_VERSION
2722
id: set_version
2823
run: echo "APP_VERSION=$(sh setversion.sh)" >> $GITHUB_ENV
2924

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/ ./...
3630
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/
4137

4238
- name: Tar Folder
39+
if: ${{ matrix.goos != 'windows'}}
4340
run: tar czf ../release.tgz ./
4441
working-directory: dist
4542

43+
4644
- name: Upload To Artifactory
45+
if: ${{ matrix.goos != 'windows'}}
4746
run: curl --fail -i -u"${BINARY_REPOSITORY_CREDENTIALS}" -T release.tgz "${BINARY_REPOSITORY_URL}/component-builds/govnc-${GIT_HASH}.tar.gz"
4847
env:
4948
BINARY_REPOSITORY_URL: ${{ secrets.BINARY_REPOSITORY_URL }}
5049
GIT_HASH: ${{ github.sha }}
5150
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

Comments
 (0)