Skip to content

Semantic Release

Semantic Release #338

name: Semantic Release
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Environment to release to. Select "staging" for a pre-release or "production" for a full release.'
options:
- staging
- production
required: true
push:
branches:
- staging
- production
concurrency:
group: kiva-ui-semantic-release
jobs:
# Create a release
create-release:
runs-on: ubuntu-latest
outputs:
published: ${{ steps.release.outputs.published }}
tag: ${{ steps.release.outputs.tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: kiva/github-actions
token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
path: .github/
- name: Run semantic-release
id: release
uses: ./.github/actions/semantic-release
env:
GITHUB_PAT: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
with:
config: "node"
environment: ${{ github.event.inputs.environment }}
# Build and push the image to ECR if the release was published
build-image:
runs-on: ubuntu-latest
needs: create-release
if: ${{ !cancelled() && needs.create-release.outputs.published == 'true' }}
env:
GITHUB_PAT: "${{ secrets.KIVA_ROBOT_GITHUB_PAT }}"
AWS_REGION: "us-west-2"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
SLACK_BOT_TOKEN: "${{ secrets.SLACK_TOKEN }}"
SLACK_CHANNEL: "eng-build-failures"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.create-release.outputs.tag }}
- uses: actions/checkout@v4
with:
repository: kiva/github-actions
token: ${{ env.GITHUB_PAT }}
path: .github/
- uses: snow-actions/[email protected]
with:
repository: kiva/marketplace-web-ui-ci
token: ${{ env.GITHUB_PAT }}
path: .docker
ref: "main"
patterns: |
resources/org/kiva/marketplaceWebUiCi/ui
- name: move files
run: |
mv .docker/resources/org/kiva/marketplaceWebUiCi/ui/Dockerfile .
- name: build static assets
uses: ./.github/actions/npm-run
with:
command: "build"
- name: upload static assets
uses: ./.github/actions/upload-static-assets
with:
source_dir: "dist/client"
include: "static/*"
cache_control: "public,max-age=31536000"
- name: docker-build
uses: ./.github/actions/docker-build-push
with:
dockerfile_target: "release"
push: true
tag_source: "git"