fix: Remove if statements + tags #7
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: "Self - Release" | |
on: | |
push: | |
branches: ["main"] | |
permissions: | |
contents: write | |
jobs: | |
fetch-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release: ${{ steps.version-changes.outputs.release }} | |
version: ${{ steps.version-changes.outputs.version }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Fetch Release" | |
id: version-changes | |
run: | | |
set -e | |
pip install yq | |
current_version=$(cat .release.yml | yq -r ".version") | |
released_version=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/:owner/:repo/releases/latest | jq -r ".tag_name") | |
if [[ "$current_version" == "NA" || "$current_version" == "$released_version" ]]; then | |
echo "No new release found" | |
echo "release=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "New release found" | |
echo "version=$current_version" >> "$GITHUB_OUTPUT" | |
echo "release=true" >> "$GITHUB_OUTPUT" | |
fi | |
release: | |
# Always pin to main as we aren't sure if the version exisits at this point | |
uses: advanced-security/reusable-workflows/.github/workflows/release.yml@main | |
needs: [ fetch-release ] | |
if: ${{ needs.fetch-release.outputs.release == 'true' }} | |
secrets: inherit | |
with: | |
version: ${{ needs.fetch-release.outputs.version }} |