Skip to content

Deploy spesifikk commit til dev #81

Deploy spesifikk commit til dev

Deploy spesifikk commit til dev #81

name: Deploy spesifikk commit til dev
on:
workflow_dispatch:
inputs:
commitHash:
description: 'SHA of the commit to deploy'
required: true
jobs:
lag_tag:
name: Lag en tag
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commitHash }}
- name: Lag tag for senere workflows
run: |
export TAG="denne_skal_deployes_til_dev-$(date +%Y-%m-%dT%H.%M.%S))
echo "$TAG" >> $GITHUB_ENV
git tag "$TAG"
git push origin "$TAG"
build:
needs: [ lag_tag ]
permissions:
contents: read
id-token: write
uses: navikt/helse-spesialist/.github/workflows/build-image.yml@master
secrets: inherit
with:
ref: denne_skal_deployes_til_dev
deployDev:
name: deploy to dev
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: denne_skal_deployes_til_dev
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/dev.yml
IMAGE: ${{ needs.build.outputs.image }}
fjern_tag:
name: Fjern deploy-tag
permissions:
contents: write
if: always()
needs: [ deployDev ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git push --delete origin refs/tags/${{ env.TAG }}