2020-11-13 14:32:18 -05:00
|
|
|
name: Docker
|
|
|
|
|
2020-11-27 04:38:38 -05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
pull_request:
|
2021-01-21 19:10:17 -05:00
|
|
|
types: [synchronize, opened, reopened, ready_for_review]
|
2020-11-13 14:32:18 -05:00
|
|
|
|
|
|
|
jobs:
|
2023-04-14 11:23:00 -04:00
|
|
|
config:
|
|
|
|
runs-on: "ubuntu-latest"
|
2021-01-21 19:10:17 -05:00
|
|
|
if: github.event.pull_request.draft == false
|
2023-04-14 11:23:00 -04:00
|
|
|
outputs:
|
|
|
|
has-secrets: ${{ steps.check.outputs.has-secrets }}
|
|
|
|
steps:
|
|
|
|
- name: "Check for secrets"
|
|
|
|
id: check
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ -n "${{ (secrets.DOCKERHUB_USER != '' && secrets.DOCKERHUB_TOKEN != '') || '' }}" ]; then
|
|
|
|
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
docker-build:
|
|
|
|
needs: config
|
|
|
|
if: needs.config.outputs.has-secrets
|
2021-02-06 19:25:46 -05:00
|
|
|
name: docker-build
|
2020-11-13 14:32:18 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-01-24 02:10:16 -05:00
|
|
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
2023-04-14 11:23:00 -04:00
|
|
|
uses: actions/checkout@v3
|
2021-01-24 02:10:16 -05:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-11-13 14:32:18 -05:00
|
|
|
|
|
|
|
- shell: bash
|
|
|
|
env:
|
|
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
.github/workflows/docker_build_push.sh
|
2021-02-24 13:50:52 -05:00
|
|
|
|
|
|
|
- name: Build ephemeral env image
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
run: |
|
|
|
|
mkdir -p ./build
|
|
|
|
echo ${{ github.sha }} > ./build/SHA
|
|
|
|
echo ${{ github.event.pull_request.number }} > ./build/PR-NUM
|
|
|
|
docker build --target ci -t ${{ github.sha }} -t "pr-${{ github.event.pull_request.number }}" .
|
|
|
|
docker save ${{ github.sha }} | gzip > ./build/${{ github.sha }}.tar.gz
|
|
|
|
|
|
|
|
- name: Upload build artifacts
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: build
|
|
|
|
path: build/
|