Skip to content

Commit c6c3137

Browse files
authored
Fixes #5 (#6)
* Initial pass cleaning up workflows * Adding workflow step echoing * Fixing logic error with step * Fixing instructions setting up step 5 * Clarify the use of draft for step 4 * Undoing step 5 instruction changes
1 parent 60a7a89 commit c6c3137

11 files changed

+125
-59
lines changed

.github/script/STEP

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1
1+
0

.github/workflows/0-start.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ permissions:
1818
pull-requests: write
1919

2020
jobs:
21-
setup:
22-
name: Setup
23-
uses: ./.github/workflows/get-current-step.yml
21+
get_current_step:
22+
name: Check current step number
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
- id: get_step
28+
run: |
29+
echo '::echo::on'
30+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
31+
outputs:
32+
current_step: ${{ steps.get_step.outputs.current_step }}
2433

2534
on_start:
2635
name: On start
27-
needs: setup
36+
needs: get_current_step
2837

2938
# We will only run this action when:
3039
# 1. This repository isn't the template repository
3140
# 2. The STEP is currently '0' (see update-step.sh)
3241
# 3. This is the first workflow run on the repository
3342
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
3443
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
35-
if: ${{ !github.event.repository.is_template
36-
&& needs.setup.outputs.current_step == 0 }}
44+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 0 }}
3745

3846
# We'll run Ubuntu for performance instead of Mac or Windows
3947
runs-on: ubuntu-latest

.github/workflows/1-create-beta-release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,29 @@ permissions:
1616
contents: write
1717

1818
jobs:
19+
get_current_step:
20+
name: Check current step number
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- id: get_step
26+
run: |
27+
echo '::echo::on'
28+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
29+
outputs:
30+
current_step: ${{ steps.get_step.outputs.current_step }}
31+
1932
on_beta_release_created:
2033
name: On beta release created
34+
needs: get_current_step
2135

2236
# We will only run this action when:
2337
# 1. This repository isn't the template repository
2438
# 1. The tag for the published release is v0.9
2539
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
2640
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
27-
if: ${{ !github.event.repository.is_template
28-
&& github.ref_name == 'v0.9' }}
41+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 1 && github.ref_name == 'v0.9' }}
2942

3043
# We'll run Ubuntu for performance instead of Mac or Windows
3144
runs-on: ubuntu-latest

.github/workflows/2-feature-added-to-release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,29 @@ permissions:
1818
contents: write
1919

2020
jobs:
21-
setup:
22-
name: Setup
23-
uses: ./.github/workflows/get-current-step.yml
21+
get_current_step:
22+
name: Check current step number
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
- id: get_step
28+
run: |
29+
echo '::echo::on'
30+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
31+
outputs:
32+
current_step: ${{ steps.get_step.outputs.current_step }}
2433

2534
on_feature_added:
2635
name: On feature added
27-
needs: setup
36+
needs: get_current_step
2837

2938
# We will only run this action when:
3039
# 1. This repository isn't the template repository
3140
# 2. The STEP is currently '2'
3241
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
3342
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
34-
if: ${{ !github.event.repository.is_template
35-
&& needs.setup.outputs.current_step == 2 }}
43+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 2 }}
3644

3745
# We'll run Ubuntu for performance instead of Mac or Windows
3846
runs-on: ubuntu-latest

.github/workflows/3-release-pr-opened.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check step 3, release pull request opened
1+
name: Check step 3, Release pull request opened
22

33
# This step triggers after 2-feature-added-to-release.yml
44
# This step sets STEP to 4
@@ -16,16 +16,29 @@ permissions:
1616
contents: write
1717

1818
jobs:
19+
get_current_step:
20+
name: Check current step number
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- id: get_step
26+
run: |
27+
echo '::echo::on'
28+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
29+
outputs:
30+
current_step: ${{ steps.get_step.outputs.current_step }}
31+
1932
on_release_pr_opened:
2033
name: On release pull request opened
34+
needs: get_current_step
2135

2236
# We will only run this action when:
2337
# 1. This repository isn't the template repository
2438
# 2. The pull request head branch is 'release-v1.0'
2539
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
2640
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
27-
if: ${{ !github.event.repository.is_template
28-
&& github.head_ref == 'release-v1.0' }}
41+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 3 && github.head_ref == 'release-v1.0' }}
2942

3043
# We'll run Ubuntu for performance instead of Mac or Windows
3144
runs-on: ubuntu-latest

.github/workflows/4-release-notes-and-merge.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check step 4, generate release notes and merge
1+
name: Check step 4, Generate release notes and merge
22

33
# This step triggers after 3-release-pr-opened.yml
44
# This step sets STEP to 5
@@ -20,18 +20,30 @@ permissions:
2020
contents: write
2121

2222
jobs:
23+
get_current_step:
24+
name: Check current step number
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
- id: get_step
30+
run: |
31+
echo '::echo::on'
32+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
33+
outputs:
34+
current_step: ${{ steps.get_step.outputs.current_step }}
35+
2336
on_release_merged:
2437
name: On release-v1.0 merged
38+
needs: get_current_step
2539

2640
# We will only run this action when:
2741
# 1. This repository isn't the template repository
2842
# 2. The pull request was closed through a merge
2943
# 3. The pull request head branch is release-v1.0
3044
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
3145
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
32-
if: ${{ !github.event.repository.is_template
33-
&& github.event.pull_request.merged == true
34-
&& github.head_ref == 'release-v1.0'}}
46+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 4 && github.event.pull_request.merged == true && github.head_ref == 'release-v1.0'}}
3547

3648
# We'll run Ubuntu for performance instead of Mac or Windows
3749
runs-on: ubuntu-latest

.github/workflows/5-finalize-release.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check step 5, commit a hotfix
1+
name: Check step 5, Commit hotfix
22

33
# This step triggers after 4-release-notes-and-merge.yml
44
# This step sets STEP to 6
@@ -17,16 +17,29 @@ permissions:
1717
pull-requests: write
1818

1919
jobs:
20+
get_current_step:
21+
name: Check current step number
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- id: get_step
27+
run: |
28+
echo '::echo::on'
29+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
30+
outputs:
31+
current_step: ${{ steps.get_step.outputs.current_step }}
32+
2033
on_release_published:
2134
name: On release v1.0 published
35+
needs: get_current_step
2236

2337
# We will only run this action when:
2438
# 1. This repository isn't the template repository
2539
# 1. The tag for the published release is v1.0.0
2640
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
2741
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
28-
if: ${{ !github.event.repository.is_template
29-
&& github.ref_name == 'v1.0.0' }}
42+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 5 && github.ref_name == 'v1.0.0' }}
3043

3144
# We'll run Ubuntu for performance instead of Mac or Windows
3245
runs-on: ubuntu-latest

.github/workflows/6-commit-hotifx.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@ permissions:
1919
contents: write
2020

2121
jobs:
22+
get_current_step:
23+
name: Check current step number
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
- id: get_step
29+
run: |
30+
echo '::echo::on'
31+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
32+
outputs:
33+
current_step: ${{ steps.get_step.outputs.current_step }}
34+
2235
on_hotfix_merged:
2336
name: On hotfix-v1.0.1 merged
37+
needs: get_current_step
2438

2539
# We will only run this action when:
2640
# 1. This repository isn't the template repository
2741
# 2. The pull request was closed through a merge
2842
# 3. The pull request head branch is hotfix-v1.0.1
2943
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
3044
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
31-
if: ${{ !github.event.repository.is_template
32-
&& github.event.pull_request.merged == true
33-
&& github.head_ref == 'hotfix-v1.0.1'}}
45+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 6 && github.event.pull_request.merged == true && github.head_ref == 'hotfix-v1.0.1' }}
3446

3547
# We'll run Ubuntu for performance instead of Mac or Windows
3648
runs-on: ubuntu-latest

.github/workflows/7-create-hotfix-release.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check step 7, create release v1.0.1
1+
name: Check step 7, Create release v1.0.1
22

33
# This step triggers after 6-commit-hotifx.yml
44
# This step sets STEP to x
@@ -16,16 +16,29 @@ permissions:
1616
contents: write
1717

1818
jobs:
19+
get_current_step:
20+
name: Check current step number
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- id: get_step
26+
run: |
27+
echo '::echo::on'
28+
echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
29+
outputs:
30+
current_step: ${{ steps.get_step.outputs.current_step }}
31+
1932
on_hotfix_release_published:
2033
name: On hotfix release v1.0.1 published
34+
needs: get_current_step
2135

2236
# We will only run this action when:
2337
# 1. This repository isn't the template repository
2438
# 1. The tag for the published release is v1.0.1
2539
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
2640
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
27-
if: ${{ !github.event.repository.is_template
28-
&& github.ref_name == 'v1.0.1' }}
41+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 7 && github.ref_name == 'v1.0.1' }}
2942

3043
# We'll run Ubuntu for performance instead of Mac or Windows
3144
runs-on: ubuntu-latest

.github/workflows/get-current-step.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)