Merge pull request #41 from Peersyst/kyc/feat/handle-not-found #57
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: "Shared modules: CI / CD" | |
on: | |
pull_request: | |
types: [opened, synchronize, closed] | |
push: | |
branches: | |
- "main" | |
jobs: | |
build-cli: | |
name: "Build package" | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PUSH_TOKEN }} | |
# Configure tag name | |
- name: Sets env vars for pull request | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "TARGET=test" >> $GITHUB_ENV | |
- name: Sets env vars for main | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
run: | | |
echo "TARGET=publish" >> $GITHUB_ENV | |
# Build and push image | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: false | |
target: ${{ env.TARGET }} | |
build-args: | | |
NPM_TOKEN=${{ secrets.NPM_TOKEN }} |