Build and Publish Artifact #15
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
name: Build and Publish Artifact | |
on: | |
workflow_dispatch: | |
inputs: | |
# Tag of the commit that be used to build the artifact that must be published | |
tag: | |
description: "Tag" | |
required: true | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.tag }} | |
- name: Set Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Yarn install | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: install | |
dir: core | |
- name: Compile application | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: compile | |
dir: core | |
- name: Build artifact | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: generate:artifacts | |
dir: core | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/terraapprove-linux | |
artifacts/terraapprove-alpine | |
tag_name: ${{ inputs.tag }} | |
# Prepare Dockerfile dependencies | |
- name: Copy artifact | |
run: | | |
cp artifacts/terraapprove-alpine docker/terraapprove-alpine | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: docker | |
file: docker/Dockerfile | |
push: true | |
tags: giovannibaratta/terraapprove:${{ inputs.tag }} |