add required field, starts discussion #38
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 docker image | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
pull_request: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- run: npm run test:unit:ci | |
- run: npm run build | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
harbor.computational.bio.uni-giessen.de/bakrep/ui | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: log | |
run: echo "TAGS ${{ steps.meta.outputs.tags }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: harbor.computational.bio.uni-giessen.de | |
username: ${{ secrets.HARBOR_USER }} | |
password: ${{ secrets.HARBOR_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Deploy | |
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
SHA: ${{ steps.short-sha.outputs.sha }} | |
with: | |
args: set image deployment/bakrep-ui bakrep-ui=harbor.computational.bio.uni-giessen.de/bakrep/ui:sha-${{ env.SHA }} |