feat: add application versioning to UI and implement automated release workflow via Gitea Actions
Release / release (pull_request) Successful in 1m13s
Release / release (pull_request) Successful in 1m13s
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'v')
|
||||
runs-on: build-htz-01
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract Version
|
||||
id: get_version
|
||||
run: |
|
||||
RAW_VERSION=${{ github.head_ref }}
|
||||
CLEAN_VERSION=${RAW_VERSION#v}
|
||||
echo "VERSION=${RAW_VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "CLEAN_VERSION=${CLEAN_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Build Binary
|
||||
run: |
|
||||
go mod tidy
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.Version=${{ steps.get_version.outputs.VERSION }}" -o goencode ./cmd/goencode
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build -t cr.jdbnet.co.uk/public/goencode:${{ steps.get_version.outputs.CLEAN_VERSION }} .
|
||||
docker push cr.jdbnet.co.uk/public/goencode:${{ steps.get_version.outputs.CLEAN_VERSION }}
|
||||
docker tag cr.jdbnet.co.uk/public/goencode:${{ steps.get_version.outputs.CLEAN_VERSION }} cr.jdbnet.co.uk/public/goencode:latest
|
||||
docker push cr.jdbnet.co.uk/public/goencode:latest
|
||||
|
||||
# - name: Generate Changelog
|
||||
# id: changelog
|
||||
# uses: https://github.com/metcalfc/changelog-generator@v4.6.2
|
||||
# with:
|
||||
# myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: ${{ steps.get_version.outputs.VERSION }}
|
||||
name: ${{ steps.get_version.outputs.VERSION }}
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
files: |
|
||||
goencode
|
||||
|
||||
- name: Upload to Cloudflare R2
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: auto
|
||||
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT_URL }}
|
||||
run: |
|
||||
aws s3 cp goencode s3://apps/goencode --endpoint-url "$R2_ENDPOINT"
|
||||
Reference in New Issue
Block a user