-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
1 parent
aa97305
commit 087c774
Showing
5 changed files
with
177 additions
and
0 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,124 @@ | ||
name: Deploy beta channel to dev | ||
|
||
# on: | ||
# workflow_dispatch: | ||
# inputs: | ||
# environment: | ||
# description: 'git-tag' | ||
# required: true | ||
|
||
env: | ||
project-directory: ./ | ||
|
||
jobs: | ||
release: | ||
name: Build Frontend Project | ||
runs-on: ubuntu-latest | ||
if: | | ||
!contains(github.event.head_commit.message, 'skip-ci') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: beta | ||
- name: git configure | ||
run: | | ||
git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf ssh://[email protected] | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
- name: npm clean install | ||
run: npm ci | ||
working-directory: ${{ env.project-directory }} | ||
- run: npm i -g semantic-release @semantic-release/{git,exec,changelog} | ||
- run: semantic-release --debug | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: get-npm-version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version-action@master | ||
# next.js build | ||
- name: build next | ||
run: npm run build | ||
working-directory: ${{ env.project-directory }} | ||
env: | ||
NODE_ENV: production | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build snapshot and push on merge | ||
id: docker_build_release | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: greenstand/${{ github.event.repository.name }}:${{ steps.package-version.outputs.current-version }} | ||
|
||
- id: export_bumped_version | ||
run: | | ||
export BUMPED_VERSION="${{ steps.package-version.outputs.current-version }}" | ||
echo "::set-output name=bumped_version::${BUMPED_VERSION}" | ||
outputs: | ||
bumped_version: ${{ steps.export_bumped_version.outputs.bumped_version }} | ||
|
||
deploy: | ||
name: Deploy to dev env | ||
runs-on: ubuntu-latest | ||
needs: release | ||
if: | | ||
!contains(github.event.head_commit.message, 'skip-ci') && | ||
github.event_name == 'push' && | ||
github.repository == "Greenstand/${{ github.event.repository.name }}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install kustomize | ||
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash | ||
- name: Run kustomize | ||
run: (cd deployment/base && ../../kustomize edit set image greenstand/${{ github.event.repository.name }}:${{ needs.release.outputs.bumped_version }} ) | ||
- name: Install doctl for kubernetes | ||
uses: digitalocean/action-doctl@v2 | ||
with: | ||
token: ${{ secrets.DEV_DIGITALOCEAN_TOKEN }} | ||
- name: Save DigitalOcean kubeconfig | ||
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DEV_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/development-beta | 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 | ||
# deploy: | ||
# name: Deploy to STAGING CDN | ||
# runs-on: ubuntu-latest | ||
# needs: frontend | ||
# if: | | ||
# github.repository == "Greenstand/${{ github.event.repository.name }}" | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Download bundled frontend resources | ||
# uses: actions/download-artifact@v2 | ||
# with: | ||
# name: frontend-bundle | ||
# path: build | ||
# - name: Configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v1 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.PROD_AWS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET }} | ||
# aws-region: us-east-1 | ||
# - name: Copy front end resources to s3 bucket | ||
# run: | | ||
# aws s3 sync build s3://${{ secrets.STAGING_CDN_S3_BUCKET }} --delete | ||
# - name: Invalidate cloudfront caches | ||
# run: | | ||
# aws cloudfront create-invalidation --distribution-id ${{ secrets.STAGING_CDN_DISTRIBUTION_ID }} --paths "/*" |
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,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: treetracker-web-map-client-beta | ||
labels: | ||
app: treetracker-web-map-client-beta | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: treetracker-web-map-client-beta | ||
template: | ||
metadata: | ||
labels: | ||
app: treetracker-web-map-client-beta | ||
containers: | ||
- name: treetracker-web-map-client | ||
image: greenstand/treetracker-web-map-client:TAG | ||
env: | ||
#- name: DATABASE_SCHEMA | ||
# value: reporting |
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,7 @@ | ||
bases: | ||
- ../../base | ||
patchesStrategicMerge: | ||
# - database-connection-sealed-secret.yaml | ||
- mapping.yaml | ||
- deployment.yaml | ||
- service.yaml |
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,9 @@ | ||
apiVersion: getambassador.io/v2 | ||
kind: Mapping | ||
metadata: | ||
name: treetracker-web-map-client-beta-be-api | ||
namespace: webmap | ||
spec: | ||
prefix: /web-map-beta/ | ||
service: treetracker-web-map-client-beta-ambassador-svc | ||
rewrite: /web-map-beta/ |
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,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: treetracker-web-map-client-beta-ambassador-svc | ||
labels: | ||
app: treetracker-web-map-client-beta | ||
name: treetracker-web-map-client-bate-ambassador-svc | ||
namespace: webmap | ||
spec: | ||
selector: | ||
app: treetracker-web-map-client-beta | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 80 | ||
targetPort: 3000 |