Skip to content

Commit

Permalink
Merge jobs: use GITHUB_ENV to pass the container name to subsequent s…
Browse files Browse the repository at this point in the history
…teps.
  • Loading branch information
octo committed Nov 23, 2023
1 parent 7197f8e commit 2cdf9bc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/merge-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get branch name
- name: Determine container name
run: |
export BRANCH="$(sed -e 's#refs/heads/##' <<<"${{ github.ref }}")"
- run: |
export SLUG="collectd/ci:${BRANCH:?}"
branch="$(sed -e 's#refs/heads/##' <<<"${GITHUB_REV}")"
echo "SLUG='collectd/ci:${branch:?}'" >>"${GITHUB_ENV}"
- name: Build container
run:
docker build --pull -t "${SLUG}" .
- run: docker inspect "${SLUG}"
- run: docker history "${SLUG}"
run: docker build --pull -t "${SLUG:?}" .
- run: docker inspect "${SLUG:?}"
- run: docker history "${SLUG:?}"
- run: docker images
- name: Log into the container registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: docker push "${SLUG}"
- run: docker push "${SLUG:?}"

0 comments on commit 2cdf9bc

Please sign in to comment.