Skip to content

Commit

Permalink
test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
havardelnan committed Nov 18, 2024
1 parent a823449 commit 4378354
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ env:
# github.repository as <account>/<repo>
# test
IMAGE_NAME: norskhelsenett/ror-cluster-agent
ROR_VERSION: v1.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
- run: |
- id: set_version
run: |
PREV_VERSION=$(gh variable get V1VERSION)
ROR_VERSION=$(echo $PREV_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
echo "ror_version=ROR_VERSION" >> "$GITHUB_OUTPUT"
gh variable set V1VERSION --body $ROR_VERSION
echo "version bumped from $PREV_VERSION to $ROR_VERSION"
build-app:
Expand All @@ -51,12 +54,15 @@ jobs:
${{ runner.os }}-go-
- name: Build
run: |
export ROR_VERSION==$(gh variable get V1VERSION)
export ROR_VERSION=$(gh variable get V1VERSION)
echo $ROR_VERSION
go get ./...
mkdir -p dist/isbuilt
CGO_ENABLED=0 go build -o dist/agent -ldflags "-w -extldflags '-static' -X internal/config.version=$ROR_VERSION -X internal/config.commit=$CI_COMMIT_SHORT_SHA" cmd/agent/main.go
touch dist/isbuilt/agent
env:
ROR_VERSION: ${{ needs.bump-version.outputs.ror_version }}

- name: Archive binary
uses: actions/upload-artifact@v4
with:
Expand All @@ -70,7 +76,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 @@ -120,6 +128,8 @@ jobs:
type=raw,value=latest
type=raw,value=latestv1
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 4378354

Please sign in to comment.