Skip to content

Commit

Permalink
ci: Use alpha suffix for NuGet pre-release in test environment (#1947)
Browse files Browse the repository at this point in the history
Co-authored-by: Magnus Sandgren <[email protected]>
Co-authored-by: Are Almaas <[email protected]>
Co-authored-by: Amund Myrbostad <[email protected]>
  • Loading branch information
4 people authored Feb 24, 2025
1 parent 3782149 commit 5ea02b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci-cd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
Expand All @@ -30,7 +30,7 @@ jobs:
build-and-test:
name: Build and test backend
uses: ./.github/workflows/workflow-build-and-test.yml
needs: [check-for-changes]
needs: [ check-for-changes ]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasTestChanges == 'true' }}

publish:
Expand All @@ -52,7 +52,7 @@ jobs:

deploy-infra:
name: Deploy infra to test
needs: [get-current-version, check-for-changes, generate-git-short-sha]
needs: [ get-current-version, check-for-changes, generate-git-short-sha ]
if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasInfraChanges == 'true' }}
uses: ./.github/workflows/workflow-deploy-infra.yml
secrets:
Expand Down Expand Up @@ -98,20 +98,30 @@ jobs:
version: ${{ needs.get-current-version.outputs.version }}-${{ needs.generate-git-short-sha.outputs.gitShortSha }}
runMigration: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }}

generate-timestamp:
name: Generate timestamp
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.get-timestamp.outputs.timestamp }}
steps:
- name: Get timestamp
id: get-timestamp
run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT

publish-sdk-to-nuget:
uses: ./.github/workflows/workflow-publish-nuget.yml
needs: [ deploy-apps, get-current-version, generate-git-short-sha, check-for-changes ]
needs: [ deploy-apps, get-current-version, generate-git-short-sha, check-for-changes, generate-timestamp ]
if: ${{ always() && !failure() && !cancelled() && ( needs.check-for-changes.outputs.hasSwaggerSchemaChanges == 'true' || needs.check-for-changes.outputs.hasWebApiClientChanges == 'true' ) }}
with:
version: ${{ needs.get-current-version.outputs.version }}-rc.${{ needs.generate-git-short-sha.outputs.gitShortSha }}
version: ${{ needs.get-current-version.outputs.version }}-alpha.${{ needs.generate-timestamp.outputs.timestamp }}+${{ needs.generate-git-short-sha.outputs.gitShortSha }}
path: 'src/Digdir.Library.Dialogporten.WebApiClient/Digdir.Library.Dialogporten.WebApiClient.csproj'
source: 'https://api.nuget.org/v3/index.json'
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

publish-schema-npm:
name: Deploy schema npm package
needs: [check-for-changes, get-current-version, generate-git-short-sha, deploy-apps]
needs: [ check-for-changes, get-current-version, generate-git-short-sha, deploy-apps ]
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSwaggerSchemaChanges == 'true' || needs.check-for-changes.outputs.hasGqlSchemaChanges == 'true') }}
uses: ./.github/workflows/workflow-publish-schema.yml
with:
Expand All @@ -123,7 +133,7 @@ jobs:
name: "Run K6 functional end-to-end tests"
# we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests
if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true' || needs.check-for-changes.outputs.hasTestChanges == 'true') }}
needs: [deploy-apps, check-for-changes]
needs: [ deploy-apps, check-for-changes ]
uses: ./.github/workflows/workflow-run-k6-tests.yml
secrets:
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}

jobs:
generate-git-short-sha:
name: Generate git short sha
uses: ./.github/workflows/workflow-generate-git-short-sha.yml

get-versions-from-github:
name: Get Latest Deployed Version Info from GitHub
uses: ./.github/workflows/workflow-get-latest-deployed-version-info-from-github.yml
Expand Down Expand Up @@ -81,10 +85,10 @@ jobs:

publish-sdk-to-nuget:
uses: ./.github/workflows/workflow-publish-nuget.yml
needs: [ deploy-apps, check-for-changes ]
needs: [ deploy-apps, check-for-changes, generate-git-short-sha ]
if: ${{ always() && !failure() && !cancelled() && ( needs.check-for-changes.outputs.hasSwaggerSchemaChanges == 'true' || needs.check-for-changes.outputs.hasWebApiClientChanges == 'true' )}}
with:
version: ${{ github.event.client_payload.version }}-rc
version: ${{ github.event.client_payload.version }}-rc+${{ needs.generate-git-short-sha.outputs.gitShortSha }}
path: 'src/Digdir.Library.Dialogporten.WebApiClient/Digdir.Library.Dialogporten.WebApiClient.csproj'
source: 'https://api.nuget.org/v3/index.json'
secrets:
Expand Down

0 comments on commit 5ea02b4

Please sign in to comment.