Skip to content

Commit b55b217

Browse files
authored
Merge pull request #121 from HilkopterBob/GitHub-Actions
GitHub actions - Add nigtly builds
2 parents eccfa45 + 9108358 commit b55b217

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/HilkopterBob/PackageLock/.github%2Fworkflows%2Frun-tests.yml)
2-
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/test-build.yml/badge.svg)
2+
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/release_tag.yml/badge.svg)
33
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/golangci-lint.yml/badge.svg)
44
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/build-docker-container.yml/badge.svg)
55
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/unstable-build-docker-container.yml/badge.svg)

0 commit comments

Comments
 (0)