Skip to content

Commit

Permalink
Address CI release issues (#30)
Browse files Browse the repository at this point in the history
* Delay PR creation to ensure artifact can be found

* Allow CI workflow to test unpublished on main

* Add workflow dispatch to release for debugging

* Allow searching older workflows

* Use PAT in release workflow
  • Loading branch information
omus authored Sep 9, 2024
1 parent a870e05 commit 9498d00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
push:
branches:
- main
paths-ignore:
- "Artifacts.toml" # Impending package release. Will trigger via `tags`
tags: ["*"]
concurrency:
# Skip intermediate builds: on all builds except on the "main" branch.
Expand All @@ -16,6 +14,7 @@ concurrency:
jobs:
unpublished:
name: Artifact Check
if: ${{ github.ref_type != 'tag' }} # Always try using published artifacts for tags
runs-on: ubuntu-latest
outputs:
key: ${{ steps.key.outputs.key }}
Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
# A valid Artifacts.toml file is required: Pkg.jl issue #2662
mv Artifacts.toml NewArtifacts.toml
git checkout origin/${{ github.base_ref }} -- Artifacts.toml
git checkout ${{ github.ref != 'refs/heads/main' && 'origin/main' || 'origin/main^' }} -- Artifacts.toml
artifact_dir="$HOME/.julia/artifacts/${{ needs.unpublished.outputs.content_hash }}"
mkdir -p "$artifact_dir"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
paths:
- "Artifacts.toml"
workflow_dispatch: {}
jobs:
publish:
name: Publish
Expand All @@ -29,11 +30,12 @@ jobs:
println(io, "tarball_filename=$tarball_filename")
println(io, "tag=v$(project.version)")
end
- uses: dawidd6/action-download-artifact@v3
- uses: dawidd6/action-download-artifact@v6
id: action-artifact
with:
workflow: Update.yaml
name: ${{ steps.details.outputs.key }}
check_artifacts: true # Check more than just the latest "Update" workflow
# As `ncipollo/release-action`'s `artifactErrorsFailBuild` input will still cause a release
# to be created we'll perform this check to fail earlier.
- name: Validate artifact retrieved
Expand All @@ -49,3 +51,4 @@ jobs:
body: ${{ steps.build_changelog.outputs.changelog }}
artifacts: ${{ steps.details.outputs.tarball_filename }}
artifactErrorsFailBuild: true
token: ${{ secrets.TZJDATA_UPDATE_TOKEN }} # Use PAT to trigger workflows on tag creation
5 changes: 5 additions & 0 deletions .github/workflows/Update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ jobs:
with:
name: ${{ steps.build.outputs.key }}
path: ${{ steps.build.outputs.tarball_path }}
# We need to introduce a slight delay after we upload the artifact to ensure the CI
# checks run for the PR can locate the artifact.
- name: Delay PR creation
if: ${{ steps.build.outputs.updated == 'true' }}
run: sleep 15
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
if: ${{ steps.build.outputs.updated == 'true' }}
Expand Down

0 comments on commit 9498d00

Please sign in to comment.