Update Terraform azurerm to v4 #1328
This file contains 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
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
name: Publish | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: use node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
registry-url: https://registry.npmjs.org/ # Needed for auth | |
cache: "npm" | |
- name: npm install | |
run: npm install | |
- name: Prettier Checks | |
run: npx prettier -c . | |
- name: "Get Short Sha Hash" | |
id: get-short-sha | |
uses: actions/[email protected] | |
with: | |
script: | | |
const shortSha = context.sha.substring(0, 7) | |
core.setOutput('shortSha', shortSha) | |
- name: "Get Commit Timestamp" | |
id: get-timestamp | |
run: | | |
TIMESTAMP=$(git log -1 --format='%cI' | sed -e's/[-T:]//g' -e's/+.*$//g') | |
echo "::set-output name=timestamp::$TIMESTAMP" | |
- name: "Build and push image" | |
uses: azure/docker-login@v2 | |
with: | |
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- run: | | |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/rpe/slack-help-bot:pr-${{github.event.number}}-${{ steps.get-short-sha.outputs.shortSha }} | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/rpe/slack-help-bot:pr-${{github.event.number}}-${{ steps.get-short-sha.outputs.shortSha }} | |
if: startsWith(github.ref, 'refs/pull') | |
- run: | | |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/rpe/slack-help-bot:prod-${{ steps.get-short-sha.outputs.shortSha }}-${{ steps.get-timestamp.outputs.timestamp }} | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/rpe/slack-help-bot:prod-${{ steps.get-short-sha.outputs.shortSha }}-${{ steps.get-timestamp.outputs.timestamp }} | |
if: github.ref == 'refs/heads/main' |