Skip to content

Commit 9ae9271

Browse files
add generate release step (#34)
2 parents d87409d + 6da2c14 commit 9ae9271

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

.github/workflows/docker-publish.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
name: Docker
1+
name: Docker
22

33
on:
44
push:
5-
tags:
6-
- '*'
5+
branches:
6+
- main
77
env:
88
IMAGE_NAME: timezonebot
99
REGISTRY: ghcr.io
1010
DOCKERDEPLOY_HOST_USER: ${{secrets.DOCKERDEPLOY_HOST_USER }}
1111
jobs:
1212
build_and_push:
13+
name: "🚀 Build, Push, and Deploy"
1314
runs-on: ubuntu-latest
1415
if: github.event_name == 'push'
1516

@@ -74,3 +75,27 @@ jobs:
7475
docker pull "${{ env.CURRENT_ID }}:latest"
7576
docker run -d --name=${{ env.IMAGE_NAME }} --env Discord__BotToken=${{ secrets.BOT_TOKEN }} --env Database__Cluster=${{ secrets.DB_CLUSTER }} --env Database__User=${{ secrets.DB_USER }} --env Database__Password=${{ secrets.DB_PASSWORD }} --env Database__Name=${{ secrets.DB_NAME }} --env FortniteApi__ApiKey=${{ secrets.FORTNITE_API_KEY }} --log-driver json-file --log-opt max-size=10m --log-opt max-file=3 --restart=unless-stopped ${{ env.CURRENT_ID }}:latest
7677
exit
78+
create_tag_and_release:
79+
name: "🏷️ Create Tag and Release"
80+
runs-on: ubuntu-latest
81+
if: github.event_name == 'push'
82+
needs: build_and_push
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Read VersionNumber from appsettings.json
86+
id: get_version
87+
run: |
88+
APP_VERSION=$(jq -r '.Version.VersionNumber' TimeZoneBot/appsettings.json)
89+
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
90+
- name: Create Tag
91+
id: create_tag
92+
run: |
93+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
94+
git config --global user.name "${{ github.actor }}"
95+
git tag -a "v${{ env.APP_VERSION }}" -m "Release version ${{ env.APP_VERSION }}"
96+
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} "v${{ env.APP_VERSION }}"
97+
- name: Create Release
98+
run: |
99+
gh release create "${{ env.APP_VERSION }}" --generate-notes --title "${{ env.APP_VERSION }}"
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

TimeZoneBot/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Version": {
3-
"VersionNumber": "7.8.3"
3+
"VersionNumber": "7.8.4"
44
},
55
"Discord": {
66
"BotToken": "token",

0 commit comments

Comments
 (0)