Skip to content

Commit

Permalink
build v2
Browse files Browse the repository at this point in the history
  • Loading branch information
havardelnan committed Nov 18, 2024
1 parent 2b42dcb commit 9b9c7cf
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/agentv2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
paths:
- v2/**
- .github/workflows/agentv2.yml
# Publish semver tags as releases.
#tags: [ 'v*.*.*' ]
pull_request:
Expand All @@ -17,11 +18,26 @@ env:
# github.repository as <account>/<repo>
# test
IMAGE_NAME: norskhelsenett/ror-cluster-agent
ROR_VERSION: v2.0.0
GH_TOKEN: ${{ secrets.VARTOKEN }}

jobs:

bump-version:
runs-on: ubuntu-latest
outputs:
ror_version: ${{ steps.set_version.outputs.ror_version }}
steps:
- uses: actions/checkout@v4
- id: set_version
run: |
PREV_VERSION=$(gh variable get V2VERSION)
ROR_VERSION=$(echo $PREV_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
echo "ror_version=$ROR_VERSION" >> "$GITHUB_OUTPUT"
gh variable set V2VERSION --body $ROR_VERSION
echo "version bumped from $PREV_VERSION to $ROR_VERSION"
build-app:
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v3

Expand All @@ -40,11 +56,14 @@ jobs:
${{ runner.os }}-go-
- name: Build
run: |
echo $ROR_VERSION
cd v2
go get ./...
mkdir -p dist/isbuilt
CGO_ENABLED=0 go build -o dist/agent -ldflags "-w -extldflags '-static' -X internal/agentconfig.version=$ROR_VERSION -X internal/agentconfig.commit=$CI_COMMIT_SHORT_SHA" cmd/agent/main.go
touch dist/isbuilt/agentv2
env:
ROR_VERSION: ${{ needs.bump-version.outputs.ror_version }}
- name: Archive binary
uses: actions/upload-artifact@v4
with:
Expand All @@ -58,7 +77,9 @@ jobs:
build-container-image:
runs-on: ubuntu-latest
#if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
needs: build-app
needs:
- build-app
- bump-version
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -107,6 +128,8 @@ jobs:
tags: |
type=raw,value=latestv2
type=raw,value=${{ env.ROR_VERSION }}
env:
ROR_VERSION: ${{ needs.bump-version.outputs.ror_version }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
Expand Down

0 comments on commit 9b9c7cf

Please sign in to comment.