generated from Greenstand/treetracker-microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy Service to Test Env | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'git-tag' | ||
required: true | ||
|
||
env: | ||
project-directory: ./ | ||
|
||
jobs: | ||
deploy-test: | ||
name: Deploy latest to test environment, requires approval | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.repository == "Greenstand/${{ github.event.repository.name }}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.inputs.git-tag }} | ||
- name: get-npm-version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version-action@master | ||
with: | ||
path: ${{ env.project-directory }} | ||
- name: Install kustomize | ||
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash | ||
working-directory: ${{ env.project-directory }} | ||
- name: Run kustomize | ||
run: (cd deployment/base && ../../kustomize edit set image greenstand/${{ github.event.repository.name }}:${{ steps.package-version.outputs.current-version }} ) | ||
working-directory: ${{ env.project-directory }} | ||
- name: Install doctl for kubernetes | ||
uses: digitalocean/action-doctl@v2 | ||
with: | ||
token: ${{ secrets.TEST_DIGITALOCEAN_TOKEN }} | ||
- name: Save DigitalOcean kubeconfig | ||
run: doctl kubernetes cluster kubeconfig save ${{ secrets.TEST_CLUSTER_NAME }} | ||
- name: Delete completed migration jobs prior to deployment | ||
run: kubectl -n ${{ secrets.K8S_NAMESPACE }} delete job --ignore-not-found=true database-migration-job | ||
- name: Update kubernetes resources | ||
run: kustomize build deployment/overlays/test | kubectl apply -n ${{ secrets.K8S_NAMESPACE }} --wait -f - | ||
- name: Attempt to wait for migration job to complete | ||
run: kubectl wait -n ${{ secrets.K8S_NAMESPACE }} --for=condition=complete --timeout=45s job/database-migration-job |
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
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
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
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
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