Detect and build new upstream based release #19
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: Detect new upstream release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7 * * 1-5" | |
jobs: | |
trigger-from-upstream: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Pipeline debug | |
if: vars.DEBUG == 'true' | |
run: | | |
echo "Upstream output: ${{ steps.upstream.outputs.upstream_version }}" | |
echo "Files:" | |
ls -lav | |
echo "Git info:" | |
git status -bv | |
git branch -v | |
echo "Log:" | |
git log --oneline --decorate --graph | |
echo "Tags:" | |
git tag --sort=committerdate | |
echo "SemVer tags:" | |
git tag --sort=committerdate | grep -E '[0-9]' | |
- name: Get the latest upstream release | |
id: upstream | |
run: | | |
upstream_version=$(curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest | jq -r '.tag_name') | |
echo "upstream_version=$upstream_version" >> $GITHUB_OUTPUT | |
echo "Found upstream release: \"$upstream_version\"" | |
- name: Get the latest FUT release | |
id: fut | |
run: | | |
fut_version=$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | sed 's/\\n/\n/g') | |
echo "Latest SemVer tag: $(git tag --sort=committerdate | grep -E '[0-9]' | tail -1)" | |
echo "fut_version=$fut_version" >> $GITHUB_OUTPUT | |
echo "Found FUT release: \"$fut_version\"" | |
- name: Create tag for the new upstream release | |
if: steps.upstream.outputs.upstream_version != steps.fut.outputs.fut_version | |
run: | | |
echo "Upstream output: ${{ steps.upstream.outputs.upstream_version }}" | |
echo "FUT output: ${{ steps.fut.outputs.fut_version }}" | |
git tag ${{ steps.upstream.outputs.upstream_version }} | |
git push origin ${{ steps.upstream.outputs.upstream_version }} |