Mathrew ʕ•ᴥ•ʔ Xian Bear Blog

Composite Run Steps GitHub Actions

A collection of composite run steps GitHub Actions.

Creating a composite action - GitHub Docs

Setup Docker Project

This composite action includes the following actions:

Definition: setup-docker/action.yml

Install the Latest Version

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12      - uses: peaceiris/workflows/setup-docker@v0.21.1
13      - run: docker compose version
14      - run: docker buildx version

Install a Specific Version

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12      - uses: peaceiris/workflows/setup-docker@v0.21.1
13        with:
14          compose-version: '2.4.1'
15          buildx-version: '0.8.2'
16      - run: docker compose version
17      - run: docker buildx version

Setup Go Project

This composite action includes the following actions:

Definition: setup-go/action.yml

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-go@v0.21.1
14        with:
15          go-version: '1.18'
16
17      - run: go version
18      - run: mage -h
19      - run: goreleaser -h

Setup Node.js Project

This composite action includes the following actions:

Definition: setup-node/action.yml

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-node@v0.21.1
14        with:
15          node-version: '16.14.2'
16          # node-version-file: '.nvmrc'
17
18      - run: node -v
19      - run: npm -v

Setup Python Project

This composite action includes the following actions:

Definition: setup-python/action.yml

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-python@v0.21.1
14        with:
15          python-version: '3.10'
16
17      - run: python3 -V
18      - run: python3 -m pip -V
19      - run: python3 -m pipenv --version

Setup Rust Project

This composite action includes the following actions:

Definition: setup-rust/action.yml

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-rust@v0.21.1

Setup goreleaser/goreleaser

Install goreleaser to a GitHub Actions Ubuntu virtual environment.

Definition: setup-goreleaser/action.yml

Install the Latest Version

Here is an example GitHub Actions workflow to install the latest goreleaser and run it.

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-goreleaser@v0.21.1
14
15      - run: goreleaser -h
16      - run: goreleaser check

Install a Specific Version

1- uses: peaceiris/workflows/setup-goreleaser@v0.21.1
2  with:
3    goreleaser-version: '1.8.1'

Setup ko-build/ko

Install ko to a GitHub Actions Ubuntu or macOS virtual environment.

Definition: setup-ko/action.yml

Install the Latest Version

Here is an example GitHub Actions workflow to install the latest ko and run it.

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-ko@v0.21.1
14
15      - run: ko version

Install a Specific Version

1- uses: peaceiris/workflows/setup-ko@v0.21.1
2  with:
3    ko-version: '0.17.1'

Setup magefile/mage

Install mage to a GitHub Actions Ubuntu virtual environment.

Definition: setup-mage/action.yml

Install the Latest Version

Here is an example GitHub Actions workflow to install the latest mage and run it.

 1name: CI
 2
 3on:
 4  push:
 5  pull_request:
 6
 7jobs:
 8  test:
 9    runs-on: ubuntu-24.04
10    steps:
11      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12
13      - uses: peaceiris/workflows/setup-mage@v0.21.1
14
15      - run: mage -h
16      - run: mage fmt

Install a Specific Version

1- uses: peaceiris/workflows/setup-mage@v0.21.1
2  with:
3    mage-version: '1.10.0'

Reusable hadolint workflow

1jobs:
2  hadolint:
3    uses: peaceiris/workflows/.github/workflows/hadolint.yml@v0.21.1

Reusable actionlint workflow

1jobs:
2  actionlint:
3    uses: peaceiris/workflows/.github/workflows/actionlint.yml@v0.21.1

Reusable pull-request merger workflow

1name: pull-request
2
3on:
4  issue_comment:
5    types: [created, edited]
6
7jobs:
8  merger:
9    uses: peaceiris/workflows/.github/workflows/merger.yml@v0.21.1

<< Previous Post

|

Next Post >>