Fix checkout version in docker-build CI flow #82
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: | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 https://github.com/actions/checkout/releases/tag/v4.1.1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 https://github.com/actions/setup-node/releases/tag/v3.8.2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm test | |
- run: npm run example | |
docker: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: 'Extract tag name' | |
shell: bash | |
run: echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
id: extract_tag | |
- | |
name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 https://github.com/actions/checkout/releases/tag/v4.1.1 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 https://github.com/docker/setup-qemu-action/releases/tag/v3.0.0 | |
- # See note on build-push-action github repo on why this needed | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 https://github.com/docker/setup-buildx-action/releases/tag/v3.0.0 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 https://github.com/docker/login-action/releases/tag/v3.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push Docker image | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 https://github.com/docker/build-push-action/releases/tag/v5.1.0 | |
with: | |
context: . # TODO: verify if needed (uses context of cwd instead of that of a fresh git checkout) | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rehoster:${{ steps.extract_tag.outputs.tag }}, ${{ secrets.DOCKERHUB_USERNAME }}/rehoster:latest | |
build-args: TAG=${{ steps.extract_tag.outputs.tag }} |