Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run release and release build in same workflow #5062

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/create-release.yaml

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/release-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc*'

env:
GITHUB_PAT: "${{ secrets.KIVA_ROBOT_GITHUB_PAT }}"
Expand Down Expand Up @@ -55,8 +52,8 @@ jobs:
# Build and push the image to ECR
build:
runs-on: ubuntu-latest
# Run on merges to development or tag pushes (done by create-release workflow)
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
# Run on merges to development (main)
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
63 changes: 56 additions & 7 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,81 @@
name: Semantic Release

on:
push:
branches:
- staging
- production
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

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
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
- name: checkout-actions
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: kiva/github-actions
token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
persist-credentials: false
path: .github/
- name: semantic-release
- name: Run semantic-release
id: release
uses: ./.github/actions/semantic-release
env:
GITHUB_PAT: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }}
with:
config: "node"

# Build and push the image to ECR if the release was published
build-image:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can most of this code move back into the gh-actions repo at some point for easier reuse?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, gha allows for reusable/shareable workflows. I think it would be great if we could eventually setup these workflows in the github actions repo and then reference them in all the app repos.

runs-on: ubuntu-latest
needs: create-release
if: 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: docker-build
uses: ./.github/actions/docker-build-push
with:
dockerfile_target: "release"
push: true
Loading