Merge pull request #90 from tv2/develop #180
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: Create and publish docker image | |
on: | |
push: | |
jobs: | |
run-yarn-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: yarn install | |
run: yarn install --check-files --frozen-lockfile | |
- name: yarn build | |
run: yarn build | |
- name: yarn install production | |
run: yarn install --check-files --frozen-lockfile --production --force | |
- uses: actions/upload-artifact@main | |
with: | |
name: dist artifacts | |
path: dist | |
push-image: | |
runs-on: ubuntu-latest | |
needs: run-yarn-build | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get standard version | |
uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: ${{ github.repository }} | |
id: version | |
- name: Log in to GitHub Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: | | |
tv2media/${{ github.event.repository.name }}:${{ steps.version.outputs.tag }} | |
tv2media/${{ github.event.repository.name }}:latest |