Rebuild docker in CI rather than locally #9
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: Publish AWS | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Rebuild-Docker-Image: | |
if: github.event.head_commit.message == 'Update Docker image' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Rebuild Docker image | |
run: | | |
make rebuild_docker | |
Build-and-Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Cache Jekyll deps | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-jekyll-deps | |
with: | |
path: | | |
${{ github.workspace }}/bundle | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Prepare workspace | |
run: | | |
cd ${{ github.workspace }} | |
- name: Build | |
env: | |
EXTRA_ARGS: --privileged | |
run: | | |
sudo chown -R 1000 ${{ github.workspace }} | |
make install | |
make build | |
sudo chown -R $USER ${{ github.workspace }} | |
- name: Publish | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
CF_DISTRIBUTION_ID: ${{ secrets.CF_DISTRIBUTION_ID }} | |
EXTRA_ARGS: --privileged | |
run: | | |
make publish |