Skip to content

Commit

Permalink
Push application to data.gov spaces
Browse files Browse the repository at this point in the history
Automatically push applications on pushes to `main` or `develop` branches.
  • Loading branch information
Aaron D Borden committed Nov 30, 2021
1 parent 281ceb3 commit a9233ba
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 9 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: deploy

on:
push:
branches:
- develop

jobs:
publish:
name: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: publish
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/gsa/cf-backup-manager:development

deploy-development:
name: deploy (development)
environment: development
runs-on: ubuntu-latest
needs:
- publish
steps:
- name: checkout
uses: actions/checkout@v2
- name: deploy
uses: usds/cloud-gov-cli@master
with:
command: push backup-manager --vars-file vars.development.yml --strategy rolling
org: gsa-datagov
space: development
user: ${{secrets.CF_SERVICE_USER}}
password: ${{secrets.CF_SERVICE_AUTH}}
61 changes: 61 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: deploy

on:
push:
branches:
- main

jobs:
publish:
name: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: publish
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/gsa/cf-backup-manager:latest

deploy-staging:
name: deploy (staging)
environment: staging
runs-on: ubuntu-latest
needs:
- publish
steps:
- name: checkout
uses: actions/checkout@v2
- name: deploy
uses: usds/cloud-gov-cli@master
with:
command: push backup-manager --vars-file vars.staging.yml --strategy rolling
org: gsa-datagov
space: staging
user: ${{secrets.CF_SERVICE_USER}}
password: ${{secrets.CF_SERVICE_AUTH}}

deploy-production:
name: deploy (production)
environment: production
runs-on: ubuntu-latest
needs:
- deploy-staging
steps:
- name: checkout
uses: actions/checkout@v2
- name: deploy
uses: usds/cloud-gov-cli@master
with:
command: push backup-manager --vars-file vars.production.yml --strategy rolling
org: gsa-datagov
space: prod
user: ${{secrets.CF_SERVICE_USER}}
password: ${{secrets.CF_SERVICE_AUTH}}
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ Cloud Foundry application to automate backup and restore of application back end
## Publishing the image

The Cloud Foundry application uses a docker image published to this repository.
New images are published on any push to `main` via GitHub Actions. Make sure
these secrets are configured.

Secret | Description
------ | -----------
GITHUB_TOKEN | A GH personal access token with scope `write:packages`. |
New images are published on any push to `main` via GitHub Actions.

## Contributing

Expand Down
7 changes: 4 additions & 3 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
applications:
- name: datastore-backup
- name: backup-manager
instances: 0
docker:
image: docker.io/adborden/cf-datastore-backup
command: sleep 3600
image: ghcr.io/gsa/cf-backup-manager:((docker_tag))
command: sleep infinity
memory: 64M
health-check-type: process
no-route: true
environment:
Expand Down
2 changes: 2 additions & 0 deletions vars.development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
docker_tag: development
2 changes: 2 additions & 0 deletions vars.production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
docker_tag: latest
2 changes: 2 additions & 0 deletions vars.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
docker_tag: latest

0 comments on commit a9233ba

Please sign in to comment.