Skip to content

Commit

Permalink
Update script and beta workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Goerentz <m.goerentz@t-online.de>

Update workflows and scripts

Signed-off-by: Marcel Goerentz <m.goerentz@t-online.de>
  • Loading branch information
marcelGoerentz committed Dec 30, 2024
1 parent 6b49234 commit 2e6af43
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
- name: Set build number
id: set-build-number
run: |
new_version=$(bash ${GITHUB_WORKSPACE}/Utility/set_buildnumber.sh ${{ vars.BUILD_NUMBER }})
echo "new_version=${new_version}" >> $GITHUB_ENV
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
bash ${GITHUB_WORKSPACE}/Utility/set_buildnumber.sh ${{ vars.BUILD_NUMBER }}
- name: Update repo variable
run: |
Expand Down Expand Up @@ -81,5 +79,5 @@ jobs:
no-cache: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
tags: |
mgoerentz/threadfin:${{ env.NEW_VERSION }}-beta
mgoerentz/threadfin:latest-beta
mgoerentz/threadfin:v${{ env.NEW_VERSION }}-beta
18 changes: 13 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
name: Threadfin Build
on:
push:
tags:
- 'v*'
branches:
- master

permissions:
contents: write
jobs:
buildBinaries:
name: Build and release binaries
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.set-build-number.outputs.new_version }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: main

- name: Set build number
id: set-build-number
run: |
bash ${GITHUB_WORKSPACE}/Utility/set_buildnumber.sh ${{ vars.BUILD_NUMBER }}
bash ${GITHUB_WORKSPACE}/Utility/set_build_number.sh ${{ vars.BUILD_NUMBER }}
- name: Update repo variable
run: |
bash ${GITHUB_WORKSPACE}/Utility/update_buildnumber_variable.sh ${{ secrets.API_TOKEN }} ${{ github.repository }} ${{ env.NEW_BUILD }}
bash ${GITHUB_WORKSPACE}/Utility/update_build_number_variable.sh ${{ secrets.API_TOKEN }} ${{ github.repository }} ${{ env.NEW_BUILD }}
- name: Set up and Build
uses: actions/setup-go@v5
Expand All @@ -45,10 +48,15 @@ jobs:
buildDockerImages:
name: Build and push Docker Images
runs-on: ubuntu-latest
needs: buildBinaries
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set NEW_VERSION
run: echo "NEW_VERSION=${{ needs.buildBinaries.outputs.new_version }}" >> $GITHUB_ENV
shell: bash

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -69,4 +77,4 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
tags: |
mgoerentz/threadfin:latest
mgoerentz/threadfin:${{ github.ref_name }}
mgoerentz/threadfin:v${{ env.NEW_VERSION }}
7 changes: 2 additions & 5 deletions Utility/set_buildnumber.sh → Utility/set_build_number.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ fi

new_build=$(($1 + 1))

echo "New build number is: $new_build"

# Extract the version number
version=$(grep 'const Version' "threadfin.go" | sed 's/.*Version = "\(.*\)"/\1/')

Expand All @@ -21,8 +19,6 @@ minor=${version_parts[1]}
patch=${version_parts[2]}
new_version="$major.$minor.$patch.$new_build"

echo "New version is: $new_version"

# Update the version in the file
sed -i "s/const Version = \".*\"/const Version = \"$new_version\"/" threadfin.go

Expand All @@ -32,4 +28,5 @@ echo "NEW_BUILD=$new_build" >> $GITHUB_ENV
# Export the new Version to the GitHub environment
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV

echo "$new_version"
# Set the output for the GitHub Actions step
echo "new_version=$new_version" >> $GITHUB_OUTPUT
File renamed without changes.

0 comments on commit 2e6af43

Please sign in to comment.