Skip to content

Commit f582cdc

Browse files
authored
Merge pull request #73 from HilkopterBob/GitHub-Actions
Partial GitHub Actions merge for release
2 parents 1159b10 + fbb3085 commit f582cdc

File tree

4 files changed

+135
-7
lines changed

4 files changed

+135
-7
lines changed
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
name: golangci-lint
22
on:
3-
push:
4-
branches:
5-
- master
63
pull_request:
74
branches:
8-
- master
9-
- devel
5+
- '*'
106

117
permissions:
128
contents: read
13-
# Optional: allow read access to pull request. Use with `only-new-issues` option.
149
pull-requests: read
10+
checks: write
1511

1612
jobs:
1713
golangci:
@@ -25,4 +21,4 @@ jobs:
2521
- name: golangci-lint
2622
uses: golangci/golangci-lint-action@v6
2723
with:
28-
version: v1.59
24+
version: v1.60

.github/workflows/release_tag.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Automatic Release Workflow
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 1.0.0)'
11+
required: true
12+
13+
jobs:
14+
release:
15+
name: Create Release
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
25+
- name: Set APP_VERSION
26+
id: version
27+
run: |
28+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
29+
VERSION=${{ github.event.inputs.version }}
30+
else
31+
VERSION=${{ github.ref }}
32+
VERSION=${VERSION#refs/tags/}
33+
fi
34+
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
35+
36+
- name: Build Go Application
37+
run: |
38+
mkdir -p ${{ github.workspace }}/packagelock
39+
APP_VERSION=${{ env.APP_VERSION }}
40+
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o ${{ github.workspace }}/packagelock
41+
42+
- name: Create Release Archive
43+
run: |
44+
mkdir -p release
45+
cp -r ${{ github.workspace }}/packagelock ./release/packagelock
46+
tar -czvf release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz -C release packagelock
47+
48+
- name: Calculate Checksum
49+
run: |
50+
md5sum ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz | cut -f 1 -d " " > ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
51+
- name: Get release URL
52+
id: get_release
53+
uses: bruceadams/get-release@v1.3.2
54+
env:
55+
GITHUB_TOKEN: ${{ github.token }}
56+
57+
- name: Upload Release Tarball
58+
id: upload-release-asset
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ steps.get_release.outputs.upload_url }}
64+
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
65+
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
66+
asset_content_type: application/gzip
67+
68+
- name: Upload Checksum
69+
id: upload-checksum-asset
70+
uses: actions/upload-release-asset@v1
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
upload_url: ${{ steps.get_release.outputs.upload_url }}
75+
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
76+
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
77+
asset_content_type: text/plain

.github/workflows/test-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Upload Go test results
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.23.x']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Installing dependencies
23+
run: go get .
24+
- name: Building Package
25+
run: go build -tags *

.github/workflows/unit-tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload Go test results
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.23.x']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
- name: Installing dependencies
23+
run: go get .
24+
- name: Run Unit Tests
25+
run: go test -json > TestResults-${{ matrix.go-version }}.json
26+
- name: Uploading Testresults
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: Go-results-${{ matrix.go-version }}
30+
path: tests/results/TestResults-${{ matrix.go-version }}.json

0 commit comments

Comments
 (0)