Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Update destroy-np.yml #14

Update destroy-np.yml

Update destroy-np.yml #14

Workflow file for this run

name: "Release"
on:
push:
branches:
- main
paths-ignore:
- "README.md"
workflow_dispatch:
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/timebot
jobs:
build:
name: Build and Publish Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate tag
id: tag
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME:${{ steps.tag.outputs.sha_short }} --label "runnumber=${GITHUB_RUN_ID}"
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: docker push $IMAGE_NAME:${{ steps.tag.outputs.sha_short }}
outputs:
docker_tag: ${{ steps.tag.outputs.sha_short }}
apply:
name: "Terraform Apply"
runs-on: ubuntu-latest
environment:
name: "nonprod"
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terragrunt
run: |
wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.45.11/terragrunt_linux_amd64
sudo mv terragrunt_linux_amd64 /usr/local/bin/terragrunt
sudo chmod +x /usr/local/bin/terragrunt
- name: Deploy Timebot to Nonprod
working-directory: infra/terragrunt/nonprod/timebot/
run: |
terragrunt apply --terragrunt-non-interactive -auto-approve
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
ARM_TENANT_ID: "1b4a4fed-fed8-4823-a8a0-3d5cea83d122"
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_NONPROD_SUBSCRIPTION_ID }}
TF_VAR_acr_subscription_id: ${{ secrets.AZURE_NONPROD_SUBSCRIPTION_ID }}
TF_VAR_timebot_image: "${{ env.IMAGE_NAME }}:${{ needs.build.outputs.docker_tag }}"
TF_VAR_app_token: ${{ secrets.NONPROD_APP_TOKEN }}
TF_VAR_bot_user_token: ${{ secrets.NONPROD_BOT_TOKEN }}
TF_VAR_harvest_token: ${{ secrets.NONPROD_HARVEST_TOKEN }}
TF_VAR_harvest_id: ${{ secrets.NONPROD_HARVEST_ID }}
TF_VAR_harvest_url: "https://api.harvestapp.com/v2/"
release:
name: "Create Release"
runs-on: ubuntu-latest
needs: apply
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install devDependencies
run: npm install
- name: Create Release
run: npm run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}