chore: short-sha workflow to simple GITHUB_SHA refs (#18332) #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Studio Observability | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - infra/observability/base/** | |
| - infra/observability/studio/** | |
| - infra/observability/build.sh | |
| - .github/workflows/deploy-studio-observability.yaml | |
| workflow_dispatch: | |
| inputs: | |
| environments: | |
| description: 'Environments to deploy to. Multiple environments can be specified by separating them with a comma.' | |
| required: false | |
| default: 'dev' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| construct-environments-array: | |
| uses: ./.github/workflows/template-studio-construct-environments.yaml | |
| with: | |
| inputs: ${{ toJSON(github.event.inputs) }} | |
| push-artifact: | |
| name: Push observability as OCI artifact | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| env: | |
| REGISTRY_NAME: altinntjenestercontainerregistry | |
| outputs: | |
| CONFIG_REPO: ${{ steps.vars.outputs.config-repo }} | |
| defaults: | |
| run: | |
| working-directory: infra/observability | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Set vars | |
| id: vars | |
| run: echo "config-repo=altinntjenestercontainerregistry.azurecr.io/altinn-studio/configs/observability-repo:${GITHUB_SHA::10}" >> "$GITHUB_OUTPUT" | |
| - name: az login | |
| uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID_FC }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }} | |
| - name: az acr login | |
| run: az acr login --name ${{ env.REGISTRY_NAME }} | |
| - name: flux install | |
| uses: fluxcd/flux2/action@bfa461ed2153ae5e0cca6bce08e0845268fb3088 # v2.8.2 | |
| - name: build manifests | |
| run: ./build.sh studio | |
| - name: push artifact | |
| run: | | |
| flux push artifact oci://${{ steps.vars.outputs.config-repo }} \ | |
| --provider=azure \ | |
| --reproducible \ | |
| --path="./dist/studio" \ | |
| --source="$(git config --get remote.origin.url)" \ | |
| --revision="$(git branch --show-current)/$(git rev-parse HEAD)" | |
| tag: | |
| name: Tag artifact | |
| needs: [push-artifact, construct-environments-array] | |
| runs-on: ubuntu-latest | |
| environment: ${{ matrix.environment }} | |
| env: | |
| REGISTRY_NAME: altinntjenestercontainerregistry | |
| strategy: | |
| matrix: | |
| include: ${{ fromJSON(needs.construct-environments-array.outputs.result) }} | |
| steps: | |
| - name: az login | |
| uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID_FC }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }} | |
| - name: az acr login | |
| run: az acr login --name ${{ env.REGISTRY_NAME }} | |
| - name: flux install | |
| uses: fluxcd/flux2/action@bfa461ed2153ae5e0cca6bce08e0845268fb3088 # v2.8.2 | |
| - name: tag artifact | |
| run: | | |
| flux tag artifact oci://${{ needs.push-artifact.outputs.CONFIG_REPO }} \ | |
| --tag ${{ matrix.environment }} |