Skip to content

Commit

Permalink
Give more explicit names to workflow and jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 committed Jul 11, 2023
1 parent 62391c7 commit eca53f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test and (if tag) build"
name: "Test, release, and build"

on:
# TODO: We currently get double workflows when pushing to pull request
Expand All @@ -21,6 +21,7 @@ defaults:

jobs:
test:
name: "Run tests"
runs-on: "ubuntu-latest"
steps:
- name: "Check out repository"
Expand Down Expand Up @@ -65,6 +66,7 @@ jobs:
# TODO: Consider extracting everything below this line to a separate workflow
# which is triggered by pushes to the default branch and GitHub releases.
build-and-release-image:
name: "Build and (if `main` or tag) release container image"
runs-on: "ubuntu-latest"
needs: ["test"]
env:
Expand All @@ -78,22 +80,22 @@ jobs:
run: |
docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" .
- name: "DockerHub login"
- name: "DockerHub login (if `main` or tag)"
if: "github.event_name == 'tag' || (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)"
uses: "docker/login-action@v2"
with:
username: "${{secrets.DOCKER_USER}}"
password: "${{secrets.DOCKER_PASS}}"

- name: "GHCR login"
- name: "GHCR login (if `main` or tag)"
if: "github.event_name == 'tag' || (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)"
uses: "docker/login-action@v2"
with:
registry: "ghcr.io"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "Release to DockerHub and GHCR"
- name: "Release to DockerHub and GHCR (if `main` or tag)"
if: "github.event_name == 'tag' || (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)"
run: |
docker push "${IMAGE_NAME}:${IMAGE_TAG}"
Expand All @@ -103,6 +105,7 @@ jobs:
build-package:
name: "Build QGreenland project (if tag)"
runs-on: "ubuntu-latest"
needs: ["build-and-release-image"]
if: "github.ref_type == 'tag'"
Expand Down

0 comments on commit eca53f3

Please sign in to comment.