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