use image name with lower case (#3) #3
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: Build and Push | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build and Push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '16.x' | |
- run: npm ci | |
- run: npm test | |
- name: Compute repo name | |
id: repo | |
run: echo name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT | |
- name: Login to GitHub Container Registry | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | |
- name: Build Docker Image | |
run: | | |
docker pull ghcr.io/${{ steps.repo.outputs.name }}:latest || : | |
docker build -t ghcr.io/${{ steps.repo.outputs.name }}:latest . \ | |
--cache-from ghcr.io/${{ steps.repo.outputs.name }}:latest \ | |
--build-arg VCS_REF=${{ github.sha }} \ | |
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
- name: Push Docker Image to GitHub Container Registry | |
run: | | |
docker push ghcr.io/${{ steps.repo.outputs.name }}:latest | |
- name: Login to GitHub Package Registry | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | |
- name: Push Docker Image to GitHub Package Registry | |
run: | | |
docker tag ghcr.io/${{ steps.repo.outputs.name }}:latest docker.pkg.github.com/${{ steps.repo.outputs.name }}/pull:latest | |
docker push docker.pkg.github.com/${{ steps.repo.outputs.name }}/pull:latest |