Skip to content

Commit

Permalink
chore(ci): enhance release fetching logic for tag pushes
Browse files Browse the repository at this point in the history
This commit modifies the GitHub Actions workflow to improve the handling of release fetching based on the event type. It introduces a conditional check to fetch the latest release only if the workflow is not triggered by a tag push. Additionally, it sets the tag name as the version when the workflow is executed on a tag push.

These changes ensure that the correct versioning is applied during the build process, enhancing the reliability of the release management in the CI/CD pipeline. The dynamic badges action is also updated to the latest version for improved functionality.
  • Loading branch information
obeone committed Aug 19, 2024
1 parent 9106688 commit 2325055
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,21 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

# Find latest tag of repository gchoi/cyberchef
- name: Fetch latest release
- name: Fetch latest release (if not run by a tag push)
uses: gregziegan/fetch-latest-release@v2.0.0
with:
github_token: ${{ github.token }}
repo_path: gchq/CyberChef
id: version
# If not from a tag push
if: github.event_name != 'push' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))

- name: Use tag name as version if run on a tag push
run: |
TAG_NAME=$(basename ${GITHUB_REF##*/})
echo ::set-output name=tag_name::${TAG_NAME}
if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/')


- name: Parse semver string
id: semver_parser
Expand Down Expand Up @@ -172,7 +181,7 @@ jobs:

- if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
name: Create date badge
uses: schneegans/dynamic-badges-action@v1.6.0
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ env.GIST_ID }}
Expand Down

0 comments on commit 2325055

Please sign in to comment.