default #1158
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: default | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 3 * * *' | |
pull_request: | |
branches: | |
- '**' | |
env: | |
REPOSITORY: andreysenov/firebase-tools | |
VERSION: 13.7.5 | |
jobs: | |
firebase-tools: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
context: [ | |
{ | |
dockerfile: Dockerfile, | |
node: node-lts, | |
os: slim, | |
platforms: 'linux/amd64,linux/arm64', | |
}, | |
{ | |
dockerfile: Dockerfile.node20, | |
node: node-20, | |
os: slim, | |
platforms: 'linux/amd64,linux/arm64', | |
}, | |
{ | |
dockerfile: Dockerfile.node18, | |
node: node-18, | |
os: slim, | |
platforms: 'linux/amd64,linux/arm64', | |
} | |
] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
if: ${{ github.event_name != 'pull_request' }} | |
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set push argument | |
if: ${{ github.event_name != 'pull_request' }} | |
run: echo PUSH_ARG="--push" >> $GITHUB_ENV | |
- name: Set extra tags if needed | |
if: ${{ github.event_name != 'pull_request' && matrix.context.dockerfile == 'Dockerfile' }} | |
run: echo EXTRA_TAGS="-t ${{ env.REPOSITORY }}:${{ env.VERSION }} -t ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }} -t ${{ env.REPOSITORY }}:latest" >> $GITHUB_ENV | |
- name: Build the Docker image | |
run: > | |
docker buildx build . ${PUSH_ARG} --no-cache --pull | |
--platform ${{ matrix.context.platforms }} | |
-f ${{ matrix.context.dockerfile }} | |
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }} | |
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }} | |
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }} | |
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}-${{ matrix.context.os }} | |
${EXTRA_TAGS} | |
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
--build-arg VERSION=${{ env.VERSION }} | |
--build-arg VCS_REF=${{ github.sha }} |