Skip to content

Commit

Permalink
chore: Application is not deleted if the branch is deleted on merge (#96
Browse files Browse the repository at this point in the history
)
  • Loading branch information
spchortis committed Aug 31, 2023
1 parent d0a8bce commit 14a0811
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions assets/github/onbranch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,39 @@ on:

jobs:
on_pr:
if: github.event.action != 'closed'
concurrency: {{ `${{ github.head_ref }}` }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: {{ `${{ github.head_ref }}` }}

- name: delete application
if: github.event.action == 'closed'
- name: build and deploy application
uses: docker://ghcr.io/nearform/initium-cli:latest
with:
args: onbranch --clean
args: onbranch
env:
INITIUM_REGISTRY_USER: {{ `${{ github.actor }}` }}
INITIUM_REGISTRY_PASSWORD: {{ `${{ secrets.GITHUB_TOKEN }}` }}
INITIUM_CLUSTER_ENDPOINT: {{ `${{ secrets.CLUSTER_ENDPOINT }}` }}
INITIUM_CLUSTER_TOKEN: {{ `${{ secrets.CLUSTER_TOKEN }}` }}
INITIUM_CLUSTER_CA_CERT: {{ `${{ secrets.CLUSTER_CA_CERT }}` }}

- name: build and deploy application
if: github.event.action != 'closed'
closed_pr:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: delete application
uses: docker://ghcr.io/nearform/initium-cli:latest
with:
args: onbranch
args: onbranch --clean --branch-name {{ `${{ github.head_ref }}` }}
env:
INITIUM_REGISTRY_USER: {{ `${{ github.actor }}` }}
INITIUM_REGISTRY_PASSWORD: {{ `${{ secrets.GITHUB_TOKEN }}` }}
INITIUM_CLUSTER_ENDPOINT: {{ `${{ secrets.CLUSTER_ENDPOINT }}` }}
INITIUM_CLUSTER_TOKEN: {{ `${{ secrets.CLUSTER_TOKEN }}` }}
INITIUM_CLUSTER_CA_CERT: {{ `${{ secrets.CLUSTER_CA_CERT }}` }}

0 comments on commit 14a0811

Please sign in to comment.