Skip to content

Commit 34f4ddc

Browse files
tj098895TeeeJay
authored andcommitted
ci: use ul and dl artifacts to exchange data betw workflows
serves also a good example for possible future use and need. Refs: equinor/ecalc-internal#433
1 parent aacd035 commit 34f4ddc

2 files changed

Lines changed: 38 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,30 @@ on:
1717
# we make it independent, and trigger it with published event from release-please workflow, instead of calling explicitly.
1818

1919
jobs:
20+
check-release-created:
21+
permissions:
22+
actions: read # to dl artifacts from triggering workflow
23+
runs-on: ubuntu-24.04
24+
steps:
25+
- name: Download release-please outputs
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: release-please-outputs
29+
run-id: ${{ github.event.workflow_run.id }}
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
- name: list contents
32+
run: ls -al
33+
- name: echo artifact
34+
run: cat outputs.json | jq .
35+
- name: Output release created
36+
id: release-created
37+
run: |
38+
echo "release_created=$(cat outputs.json | jq -r '.release_created')" >> $GITHUB_OUTPUT
39+
outputs:
40+
release-created: ${{ steps.release-created.outputs.release_created }}
2041
publish:
21-
# NOTE: Only run if release-please creates a release, ie. it successfully ends
22-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
42+
needs: check-release-created
43+
if: ${{ needs.check-release-created.outputs.release-created == 'true' }}
2344
environment:
2445
name: pypi
2546
url: https://pypi.org/project/libecalc/

.github/workflows/release-please.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ jobs:
2121
release_created: ${{ steps.release.outputs.release_created }}
2222
tag_name: ${{ steps.release.outputs.tag_name }}
2323

24-
no-release-created:
25-
if: ${{ needs.release-please.outputs.release_created != 'true' }}
24+
create-output-artifact:
2625
runs-on: ubuntu-24.04
2726
steps:
28-
- name: No release created
27+
- name: Create output directory
28+
run: mkdir -p release-please-data
29+
- name: set release created
30+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
2931
run: |
30-
echo "No release created, setting output to false, to avoid triggering publish workflow."
31-
exit 1
32+
echo '{"release_created":"true"}' > release-please-data/outputs.json
33+
- name: set release NOT created
34+
if: ${{ needs.release-please.outputs.release_created != 'true' }}
35+
run: |
36+
echo '{"release_created":"false"}' > release-please-data/outputs.json
37+
- name: Upload release-please data
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: release-please-outputs
41+
path: release-please-data/

0 commit comments

Comments
 (0)