Update actions/setup-node action to v4.0.4 (#135) #237
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: Docker | |
"on": | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
name: Build and push | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dockerfile: | |
- Dockerfile.rust | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Get image name from Dockerfile name | |
id: name | |
run: | | |
image_name=$(echo ${{ matrix.dockerfile }} | cut -d '.' -f 2) | |
echo "image_name=$image_name" >> $GITHUB_OUTPUT | |
echo "$image_name" | |
- name: Collect metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/${{ steps.name.outputs.image_name }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
file: ${{ matrix.dockerfile }} | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |