mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-08 17:37:01 +00:00
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: Build wonderwall
|
|
|
|
on: [push]
|
|
|
|
env:
|
|
image_base: ghcr.io/${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
name: Build, push and deploy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Docker login
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
|
|
- name: Set version
|
|
run: |
|
|
echo "VERSION=$(./version.sh)" >> $GITHUB_ENV
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build . --tag ${{ env.image_base }}:${{ env.VERSION }} --tag ${{ env.image_base }}:latest
|
|
- name: Push versioned docker image
|
|
run: |
|
|
docker push ${{ env.image_base }}:${{ env.VERSION }}
|
|
- name: Push latest docker image
|
|
if: github.ref == 'refs/heads/master'
|
|
run: docker push ${{ env.image_base }}:latest
|
|
- uses: nais/deploy/actions/deploy@v1
|
|
if: github.ref == 'refs/heads/master'
|
|
env:
|
|
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
|
|
CLUSTER: dev-gcp
|
|
RESOURCE: .nais/nais.yml
|
|
VAR: image=${{ env.image_base }}:${{ env.VERSION }}
|