Merge pull request #22 from golang-cz/features #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
uses: ./.github/workflows/checks.yml # use the callable tests job to run tests | ||
Check failure on line 15 in .github/workflows/ci.yml GitHub Actions / .github/workflows/ci.ymlInvalid workflow file
|
||
docker-build: | ||
needs: [tests] | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILDER_IMAGE: golang:1.21-alpine3.18 | ||
steps: | ||
- name: Git clone | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} # Checkout Pull Request HEAD commit instead of the default Pull Request merge commit. | ||
- name: Log into Github registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- name: Docker build | ||
run: | | ||
PULL_REQUEST_ID=${{ github.event.number }} | ||
export COMMIT="$(git log -1 --pretty=format:'%h')" | ||
export VERSION="$(date -d @$(git log -n1 --format=%at) +'v%-y.%-m.%-d')-${COMMIT}${PULL_REQUEST_ID:+-PR-$PULL_REQUEST_ID}" | ||
docker build --build-arg BUILDER_IMAGE=${BUILDER_IMAGE} --build-arg VERSION=${VERSION} --build-arg COMMIT=${COMMIT} -t ghcr.io/skeleton:$VERSION . | ||
docker push ghcr.io/skeleton:$VERSION |