Merge pull request #943 from CubeArtisan/csv-override #99
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: Build Docker For Production | |
on: | |
push: | |
branches: | |
- prod | |
jobs: | |
build: | |
name: Create Release, Build Docker, and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Parse Release Notes | |
run: | | |
sed -n "{1! G;$ p;h}" RELEASE_NOTES.md | sed '/#\+ v/q' | sed -n "{1! G;$ p;h}" > THIS_RELEASE_NOTES.md | |
export STOR=`head -n 1 THIS_RELEASE_NOTES.md | sed 's/^\(#\+\) \(v.*\)/\1/'` | |
echo "TAG=`head -n 1 THIS_RELEASE_NOTES.md | sed 's/^\(#\+\) \(v.*\)/\2/'`" >> $GITHUB_ENV | |
tail -n +3 THIS_RELEASE_NOTES.md | sed 's/^'$STOR'//g' > FINAL_RELEASE_NOTES.md | |
- name: Get Repository Owner | |
run: echo "REPOSITORY=`echo 'ghcr.io/${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]'`" >> $GITHUB_ENV | |
- name: Show tag and repo | |
run: 'echo "REPOSITORY: $REPOSITORY" && echo "TAG: $TAG"' | |
- name: Login to Docker | |
run: docker login -u $GITHUB_ACTOR -p ${{ secrets.GITHUB_TOKEN }} 'ghcr.io' | |
- name: Build the Docker image | |
run: docker-compose -f .docker/docker-compose.yml build | |
- name: Push to github package registry | |
run: docker-compose -f .docker/docker-compose.yml push | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG }} | |
release_name: Release ${{ env.TAG }} | |
draft: false | |
prerelease: false | |
body_path: FINAL_RELEASE_NOTES.md | |
- name: Trigger deploy | |
run: | | |
curl \ | |
-X POST \ | |
-H 'Accept: application/vnd.github.v3+json' \ | |
-H 'authorization: Bearer ${{ secrets.DEPLOY_TOKEN }}' \ | |
-H 'content-type: application/json' \ | |
--data '{"event_type": "deploy_prod", "client_payload": { "repository": "'"$REPOSITORY"'", "tag": "'"$TAG"'" }}' \ | |
https://api.github.com/repos/CubeArtisan/cubeartisan-infrastructure/dispatches |