Legger til utviklingsmilø for nkr #388
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: Publish Docker image | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 21 * * 0' # run Sundays at 21 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
images: ${{ steps.filter.outputs.changes }} | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
rstudio: "rstudio/**" | |
base-r: "base-r/**" | |
dev: "dev/**" | |
deformitet-dev: "deformitet-dev/**" | |
ltmv-dev: "ltmv-dev/**" | |
norgast-dev: "norgast-dev/**" | |
nnrr-dev: "nnrr-dev/**" | |
nra-dev: "nra-dev/**" | |
norspis-dev: "norspis-dev/**" | |
muskel-dev: "muskel-dev/**" | |
smerte-dev: "smerte-dev/**" | |
ablanor-dev: "ablanor-dev/**" | |
noric-dev: "noric-dev/**" | |
rapregtemplate-dev: "rapregtemplate-dev/**" | |
base-r-alpine: "base-r-alpine/**" | |
pilot-dev: "pilot-dev/**" | |
norvas-dev: "norvas-dev/**" | |
rygg-dev: "rygg-dev/**" | |
push_to_registries: | |
needs: changes | |
if: ${{ needs.changes.outputs.images != '[]' && needs.changes.outputs.images != '' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: ${{ fromJSON(needs.changes.outputs.images) }} | |
name: ${{ matrix.image }} | |
steps: | |
- name: Check out the repo | |
uses: actions/[email protected] | |
- name: Lint Dockerfile | |
uses: hadolint/[email protected] | |
with: | |
dockerfile: "${{ matrix.image }}/Dockerfile" | |
- name: Prepare tags | |
id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: rapporteket/${{ matrix.image }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=schedule,pattern=weekly | |
type=semver,pattern={{version}} | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/[email protected] | |
with: | |
context: ./${{ matrix.image }}/. | |
file: ./${{ matrix.image }}/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
build-args: | | |
GITHUB_PAT=${{ secrets.GH_TOKEN }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |