Merge pull request #23 from Duddino/github-cli-test #18
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 release container image | |
on: | |
push: | |
branches: | |
- "master" | |
paths-ignore: | |
- "*.md" | |
- LICENCE | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install npm/nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install packages | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Github Packages | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Set tag date-SHA | |
id: tag | |
run: echo "tag=$(date +'%Y-%m-%d')-$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV | |
- name: Build image and push to GitHub Container Registry | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64 | |
tags: | | |
ghcr.io/pivx-labs/mypivxwallet:latest | |
ghcr.io/pivx-labs/mypivxwallet:${{ env.tag }} | |
${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: release=1 | |
push: true | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |