Merge pull request #392 from tst-labs/dependabot/npm_and_yarn/fronten… #102
Workflow file for this run
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 publish | |
on: | |
push: | |
branches: | |
- master | |
- main | |
tags: | |
- "v*" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: src | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "8" | |
distribution: "adopt" | |
- name: Build with Maven | |
run: mvn -B package | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
tstlabs/esocial-jt-service | |
ghcr.io/tst-labs/esocial-jt-service | |
- name: Docker build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./src | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
frontend-publish: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: frontend | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16.x" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn test | |
- name: Build | |
run: yarn build | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
tstlabs/esocial-jt-frontend | |
ghcr.io/tst-labs/esocial-jt-frontend | |
- name: Docker build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |