Skip to content

Commit

Permalink
Switch to Docker's Actions (aptible#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
almathew authored Jan 4, 2022
1 parent 933107d commit 35d09b0
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 59 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/deploy.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: test-and-release

on:
push:
branches: [ main ]
release:
types:
- created

jobs:
release:
name: Release code
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Log in to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract tags for Docker images
id: docker-meta
uses: docker/metadata-action@v3
with:
images: quay.io/aptible/www-prod

- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
build-args: |
CONTENTFUL_ACCESS_TOKEN=${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_SPACE_ID=${{ secrets.CONTENTFUL_SPACE_ID }}
# The `if` in this step and the following step are a bit ugly, but this is the cleanest
# way I found short of having two actions.
- name: Deploy code to staging
uses: aptible/aptible-deploy-action@v1
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
username: ${{secrets.APTIBLE_ROBOT_USERNAME}}
password: ${{secrets.APTIBLE_ROBOT_PASSWORD}}
app: 'www-staging'
environment: 'aptible-staging'
docker_img: 'quay.io/aptible/www-prod:main'

- name: Deploy code to production
uses: aptible/aptible-deploy-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
username: ${{secrets.APTIBLE_ROBOT_USERNAME}}
password: ${{secrets.APTIBLE_ROBOT_PASSWORD}}
app: 'www-prod'
environment: 'aptible-production'
docker_img: 'quay.io/aptible/www-prod:latest'
30 changes: 0 additions & 30 deletions .github/workflows/staging.yml

This file was deleted.

0 comments on commit 35d09b0

Please sign in to comment.