diff --git a/.github/workflows/alerts-dev.yml b/.github/workflows/alerts-dev.yml deleted file mode 100644 index 2887609f7..000000000 --- a/.github/workflows/alerts-dev.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy alerts to dev -on: - push: - branches: - - dev - paths: - - 'alerts-dev.yaml' - - 'alerts-dev-arena.yaml' - - '.github/workflows/alerts-dev.yaml' - -concurrency: - group: deploy_alerts_dev - cancel-in-progress: true - -jobs: - apply-alerts: - name: Apply alerts to dev - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: deploy to dev - uses: nais/deploy/actions/deploy@v1 - env: - APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} - CLUSTER: dev-fss - RESOURCE: alerts-dev.yaml - - name: deploy arena alert - uses: nais/deploy/actions/deploy@v1 - env: - APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} - CLUSTER: dev-fss - RESOURCE: alerts-dev-arena.yaml diff --git a/.github/workflows/alerts-prod.yml b/.github/workflows/alerts.yml similarity index 52% rename from .github/workflows/alerts-prod.yml rename to .github/workflows/alerts.yml index 11c1c99dd..6cb6b1a0e 100644 --- a/.github/workflows/alerts-prod.yml +++ b/.github/workflows/alerts.yml @@ -6,14 +6,35 @@ on: paths: - 'alerts-prod.yaml' - 'alerts-prod-arena.yaml' - - '.github/workflows/alerts-prod.yaml' + - 'alerts-dev.yaml' + - 'alerts-dev-arena.yaml' + - '.github/workflows/alerts.yaml' concurrency: group: deploy_alerts_prod cancel-in-progress: true jobs: - apply-alerts: + apply-alerts-dev: + name: Apply alerts to dev + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v1 + - name: deploy to dev + uses: nais/deploy/actions/deploy@v1 + env: + APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} + CLUSTER: dev-fss + RESOURCE: alerts-dev.yaml + - name: deploy arena alert + uses: nais/deploy/actions/deploy@v1 + env: + APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} + CLUSTER: dev-fss + RESOURCE: alerts-dev-arena.yaml + + apply-alerts-prod: name: Apply alerts to prod runs-on: ubuntu-latest steps: diff --git a/.github/workflows/prod.yml b/.github/workflows/deploy.yml similarity index 67% rename from .github/workflows/prod.yml rename to .github/workflows/deploy.yml index a65a585bb..da5023b54 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/deploy.yml @@ -1,8 +1,9 @@ name: Prod on: push: + workflow_dispatch: branches: - - master + - main concurrency: group: deploy_prod @@ -39,9 +40,39 @@ jobs: docker build -t ${IMAGE}:${IMAGE_TAG} . docker push ${IMAGE}:${IMAGE_TAG} + deploy-dev: + name: Deploy application to Q1 + needs: test-build-and-push + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Deploy application + uses: nais/deploy/actions/deploy@v1 + env: + APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} + CLUSTER: dev-fss + RESOURCE: nais-q.yaml + VAR: version=${{ env.IMAGE_TAG }},namespace=q1 + + release-dev: + name: Create dev release + needs: deploy-dev + runs-on: ubuntu-latest + steps: + - name: Create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: release/dev@${{ env.IMAGE_TAG }} + release_name: Release to dev + prerelease: true + deploy-prod: name: Deploy application to prod - needs: test-build-and-push + needs: deploy-dev + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout @@ -57,6 +88,7 @@ jobs: release-prod: name: Create prod release needs: deploy-prod + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Create release diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index 85c7f83a3..000000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Dev -on: - workflow_dispatch: - push: - branches: - - dev - -concurrency: - group: deploy_dev - cancel-in-progress: true - -env: - IMAGE_TAG: ${{ github.sha }} - IMAGE: docker.pkg.github.com/${{ github.repository }}/veilarbaktivitet - PRINT_PAYLOAD: true - -jobs: - test-build-and-push: - name: Test, build and push - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-maven- - - name: Build maven artifacts - run: mvn -B package - - name: Build and push Docker image - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN} - docker build -t ${IMAGE}:${IMAGE_TAG} . - docker push ${IMAGE}:${IMAGE_TAG} - - deploy-dev: - name: Deploy application to Q1 - needs: test-build-and-push - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Deploy application - uses: nais/deploy/actions/deploy@v1 - env: - APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} - CLUSTER: dev-fss - RESOURCE: nais-q.yaml - VAR: version=${{ env.IMAGE_TAG }},namespace=q1 - - release-dev: - name: Create dev release - needs: [deploy-dev] - runs-on: ubuntu-latest - steps: - - name: Create release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: release/dev@${{ env.IMAGE_TAG }} - release_name: Release to dev - prerelease: true