Skip to content

Kjører under port 8686 ved profil postgres (#826) #473

Kjører under port 8686 ved profil postgres (#826)

Kjører under port 8686 ved profil postgres (#826) #473

Workflow file for this run

name: Bygg og deploy
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENSE'
- 'CODEOWNERS'
jobs:
docker-and-nais-deploy:
name: Laste opp docker image og deploye app
runs-on: ubuntu-latest
permissions:
issues: write
packages: write
contents: read
steps:
- name: Hente kode
uses: actions/checkout@v4
- name: Sette opp Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven
- name: Bygge jar
env:
GITHUB_USERNAME: x-access-token
GITHUB_PASSWORD: ${{ secrets.READER_TOKEN }}
run: |
mvn verify --batch-mode --settings ./.m2/settings.xml --file pom.xml -DtrimStackTrace=false -Drevision= -Dchangelist= -Dsha1="$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S')-$(echo $GITHUB_SHA | cut -c1-7)"
echo "TAG=$(expr $(date +%Y%m%d%H%M%S))-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Bygg og last opp Docker image
run: |
docker build --pull --tag ${IMAGE_BASE?}:${TAG?} --tag ${IMAGE_BASE}:latest .
docker push ${IMAGE_BASE} --all-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_BASE: ghcr.io/${{ github.repository }}/server
- name: Lukk gamle issues
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['deployment']
}).then(response => {
response.data.forEach(issue => {
github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
});
});
});
- name: Opprett deployment issue
id: createdeployissue
if: success()
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.create( {
owner: context.issue.owner,
repo: context.issue.repo,
labels: ['deployment'],
body: '${{ github.sha }}',
title: 'Deploy av ${{ env.TAG }}'})
.then(response => {
core.setOutput('number', response.data.number);
});
- name: Trigger deploy til dev
uses: actions/github-script@v6
with:
github-token: ${{secrets.GH_TOKEN}}
script: |
const issue = { owner: context.issue.owner,
repo: context.issue.repo,
issue_number: ${{ steps.createdeployissue.outputs.number }} }
github.rest.issues.createComment({...issue,
title: 'Deploy av ${{ env.TAG }}',
body: '/promote dev-fss'})