Merge branch 'master' into release-tag #3
Workflow file for this run
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: crucible-release | ||
on: | ||
workflow_call: | ||
inputs: | ||
dry-run: | ||
required: false | ||
type: boolean | ||
description: Do NOT push new generated tag to the upstream repositories | ||
default: false | ||
env: | ||
GITHUB_WORKSPACE: ${{ inputs.github_workspace }} | ||
jobs: | ||
release-tag: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
outputs: | ||
tag: ${{ steps.gen-release-tag.outputs.tag }} | ||
steps: | ||
- name: Generate release tag | ||
id: gen-release-tag | ||
run: | | ||
year="$(date +%Y)" | ||
month="$(date +%m)" | ||
quarter="$(((month-1)/3+1))" | ||
echo "tag=$year.$quarter" >> $GITHUB_OUTPUT | ||
- name: Get release tag | ||
id: get-release-tag | ||
env: | ||
TAG: ${{ needs.release-tag.outputs.tag }} | ||
run: echo "$TAG" | ||
remote-tag: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
- name: checkout crucible default | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: perftool-incubator/crucible | ||
ref: master | ||
path: crucible | ||
- name: check if tag exists on the crucible repo | ||
env: | ||
TAG: ${{ needs.release-tag.outputs.tag }} | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
cd crucible | ||
git ls-remote --tags origin | grep -v "$TAG" | ||
sub-projects: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
outputs: | ||
repos: ${{ steps.get-repos.outputs.repos }} | ||
- name: Get the list of sub-projects | ||
id: get-repos | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
cd crucible | ||
# get first column (repo name) and add to a bash array ( a b c) | ||
projects=( $(grep -v ^# config/default_subprojects | awk {'print $1'} ) ) | ||
# builtin implict join array a,b,c | ||
printf -v list '%s,' "${projects[@]}" | ||
# convert to a comma separated list [a,b,c] | ||
echo "repos=[${list%,}]" >> $GITHUB_OUTPUT | ||
push-tags: | ||
needs: | ||
- release-tag | ||
- remote-tag | ||
- sub-projects | ||
strategy: | ||
matrix: | ||
repository: ${{ needs.sub-projects.outputs.repos }} | ||
steps: | ||
- name: Display sub-project repository name | ||
run: | | ||
echo "repository=${{ matrix.repository }}" | ||
- name: checkout sub-project repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: perftool-incubator/${{ matrix.repository }} | ||
ref: '' | ||
path: '' | ||
- name: create release tag | ||
env: | ||
TAG: ${{ needs.release-tag.outputs.tag }} | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
cd ${{ matrix.repository }} | ||
git tag $TAG | ||
- name: push release tag | ||
if: ${{ inputs.dry_run == false }} | ||
env: | ||
TAG: ${{ needs.release-tag.outputs.tag }} | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
cd ${{ matrix.repository }} | ||
######git push origin $TAG | ||
echo "git push origin $TAG" | ||
- name: check if tag has been pushed | ||
if: ${{ inputs.dry_run == false }} | ||
env: | ||
TAG: ${{ needs.release-tag.outputs.tag }} | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
cd ${{ matrix.repository }} | ||
git ls-remote --tags origin | grep "$TAG" | ||
git fetch -t | ||
git tag -l "$TAG" | ||
crucible-stable-release-complete: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
needs: | ||
- push-tags | ||
steps: | ||
- name: Confirm Success | ||
run: echo "crucible-stable-release-complete" |