Skip to content

Commit

Permalink
Updates to match template (#16)
Browse files Browse the repository at this point in the history
* Updates to match template

* Add or update get current step jobs

* Update job conditional to include current step

* Update README.md

* Update README.md
  • Loading branch information
heiskr authored Feb 14, 2023
1 parent 0969984 commit d889474
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 9 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/0-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,29 @@ permissions:
pull-requests: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_start:
name: On start

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 0
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 0 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/1-create-the-workflow-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_create_publish_yml:
name: On create publish yml

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 1
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 1 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/2-add-a-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_push_dockerfile:
name: On push Dockerfile

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 2
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 2 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/3-merge-your-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_push_main:
name: On push main

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 3
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 3 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _Use GitHub Actions to publish your project to a Docker image._
Do not use quotes on the <details> tag attributes.
-->

<!--step0-->
<details id=0 open>
<summary><h2>Welcome</h2></summary>

GitHub Actions makes it easier than ever to incorporate continuous delivery (CD) into your repositories. This course will teach you what is needed to test and deliver artifacts that are ready for deployment.

Expand All @@ -30,15 +31,15 @@ GitHub Actions makes it easier than ever to incorporate continuous delivery (CD)

## How to start this course

1. Above these instructions, right-click **Use this template** and open the link in a new tab.
![Use this template](https://user-images.githubusercontent.com/1221423/169618716-fb17528d-f332-4fc5-a11a-eaa23562665e.png)
1. Right-click **Start course** and open the link in a new tab.
<br />[![start-course](https://user-images.githubusercontent.com/1221423/218596841-0645fe1a-4aaf-4f51-9ab3-8aa2d3fdd487.svg)](https://github.com/skills/publish-packages/generate)
2. In the new tab, follow the prompts to create a new repository.
- For owner, choose your personal account or an organization to host the repository.
- We recommend creating a public repository—private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
![Create a new repository](https://user-images.githubusercontent.com/1221423/169618722-406dc508-add4-4074-83f0-c7a7ad87f6f3.png)
![Create a new repository](https://user-images.githubusercontent.com/1221423/218594143-e60462b6-9f2a-4fa3-80de-063ac5429aab.png)
3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.

<!--endstep0-->
</details>

<!--
<<< Author notes: Step 1 >>>
Expand Down

0 comments on commit d889474

Please sign in to comment.