Deploy to Aptible #506
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
name: Deploy to Aptible | |
on: | |
workflow_run: | |
workflows: ["Run tests"] | |
types: [completed] | |
branches: [main] | |
workflow_dispatch: | |
inputs: { } | |
env: | |
USERNAME: ${{ secrets.GPR_USER }} | |
TOKEN: ${{ secrets.GPR_KEY }} | |
jobs: | |
deploy: | |
name: Deploy to Aptible | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
fetch-depth: 0 | |
- name: Install SSH Key | |
uses: shimataro/[email protected] | |
with: | |
key: ${{ secrets.APTIBLE_SSH_PRIVATE_KEY }} | |
known_hosts: ${{ secrets.APTIBLE_KNOWN_HOSTS }} | |
- name: Push to Aptible remote branch | |
run: | | |
ssh-keyscan beta.aptible.com >> ~/.ssh/known_hosts | |
git remote add aptible ${{ vars.APTIBLE_REMOTE_URL }} | |
git push --force ${{ vars.APTIBLE_REMOTE_URL }} ${GITHUB_SHA}:${{ vars.APTIBLE_REMOTE_BRANCH }} | |
- name: Announce on Slack when deploy fails | |
if: failure() | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Set Aptible environment variables and deploy | |
run: | | |
wget -O aptible-package https://omnibus-aptible-toolbelt.s3.amazonaws.com/aptible/omnibus-aptible-toolbelt/master/206/pkg/aptible-toolbelt_0.16.5%2B20200508143656~ubuntu.16.04-1_amd64.deb | |
sudo dpkg -i aptible-package | |
aptible login --email=${{ secrets.APTIBLE_USERNAME }} --password=${{ secrets.APTIBLE_PASSWORD}} | |
aptible deploy --app demo --git-commitish ${{ vars.APTIBLE_REMOTE_BRANCH }} SPRING_PROFILES_ACTIVE=demo \ | |
'SPRING_DATASOURCE_URL=${{ secrets.SPRING_DATASOURCE_URL }}' \ | |
'AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }}' \ | |
'AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }}' \ | |
'SMARTY_AUTH_ID=${{ secrets.SMARTY_AUTH_ID }}' \ | |
'SMARTY_AUTH_TOKEN=${{ secrets.SMARTY_AUTH_TOKEN }}' \ | |
'MAILGUN_KEY=${{ secrets.MAILGUN_KEY }}' \ | |
'SPRING_DATASOURCE_USERNAME=${{ secrets.SPRING_DATASOURCE_USERNAME }}' \ | |
'SPRING_DATASOURCE_PASSWORD=${{ secrets.SPRING_DATASOURCE_PASSWORD }}' \ | |
'CLAMAV_URL=${{ vars.CLAMAV_URL }}' |