Skip to content

Update publish.yml #124

Update publish.yml

Update publish.yml #124

Workflow file for this run

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: Login to GitHub Container Registry
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker Image
run: |
docker pull ghcr.io/${{ github.repository }}:latest || :
docker build -t ghcr.io/${{ github.repository }}:latest . \
--cache-from ghcr.io/${{ github.repository }}: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/${{ github.repository }}: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/${{ github.repository }}:latest docker.pkg.github.com/${{ github.repository }}/pull:latest
docker push docker.pkg.github.com/${{ github.repository }}/pull:latest