Remove Centos7 image due to EOL (#148) #104
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 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
push: | |
description: Push to Docker hub after build is complete. | |
default: true | |
type: boolean | |
services: | |
description: Space delimited string of services to build. If empty, all will be built. | |
type: string | |
schedule: | |
- cron: '0 0 * * 6' | |
env: | |
TASK_VERSION: v3.29.1 | |
TASK_CHECKSUM: e411770abf73d5e094100ab7a1c8278f35b591ecadbfd778200b6b2ad1ee340b | |
# If this changes, also update the if on the docs job. We unfortunately can't | |
# use env.PUSH in the if there. | |
PUSH: ${{ (inputs.push || github.event_name == 'schedule' || github.event_name == 'push') && 'true' || 'false' }} | |
jobs: | |
matrix: | |
name: Create service matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: .github/workflows/gha-matrix.sh ${{ inputs.services }} >> $GITHUB_OUTPUT | |
build: | |
name: Build service | |
needs: matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: sudo apt-get update | |
&& sudo apt-get install -y eatmydata | |
&& sudo ln -snf /usr/bin/eatmydata /usr/local/bin/apt-get | |
&& sudo apt-get install -y parallel jq curl | |
&& curl -L -o /tmp/task_linux_amd64.deb https://github.com/go-task/task/releases/download/${{ env.TASK_VERSION }}/task_linux_amd64.deb | |
&& sha256sum /tmp/task_linux_amd64.deb | grep -q ${{ env.TASK_CHECKSUM }} | |
&& sudo dpkg -i /tmp/task_linux_amd64.deb | |
&& sudo apt-get clean | |
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
- | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
# Expose the actions cache url and token. | |
# https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication | |
name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v2 | |
- run: task -- ${{ matrix.service }} | |
id: task | |
docs: | |
name: Generate docs | |
needs: build | |
runs-on: ubuntu-latest | |
# If the push portion of this logic changes, change env.PUSH logic as well. | |
if: always() && (inputs.push || github.event_name == 'schedule' || github.event_name == 'push') | |
steps: | |
- name: Install dependencies | |
run: sudo apt-get update | |
&& sudo apt-get install -y curl rsync | |
&& curl -L -o /tmp/task_linux_amd64.deb https://github.com/go-task/task/releases/download/${{ env.TASK_VERSION }}/task_linux_amd64.deb | |
&& sha256sum /tmp/task_linux_amd64.deb | grep -q ${{ env.TASK_CHECKSUM }} | |
&& sudo dpkg -i /tmp/task_linux_amd64.deb | |
&& sudo apt-get clean | |
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
- name: Checkout TugboatQA/images | |
uses: actions/checkout@v3 | |
with: | |
path: images | |
- name: Checkout TugboatQA/dockerfiles | |
uses: actions/checkout@v3 | |
with: | |
repository: TugboatQA/dockerfiles | |
path: dockerfiles | |
- name: Generate docs | |
working-directory: images | |
run: task generate && task prepare-docs | |
- name: Sync docs | |
run: rsync -av | |
--delete | |
--exclude .git | |
--exclude LICENSE | |
--exclude README.md | |
--exclude MANIFEST_LIST | |
--exclude '*/built' | |
images/images/ dockerfiles/ | |
- name: Configure SSH Agent | |
uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Commit and push | |
working-directory: dockerfiles | |
run: | | |
test "$PUSH" != "1" \ | |
&& test "$PUSH" != "true" \ | |
&& echo "Skipping push: PUSH=$PUSH" \ | |
&& exit 0 \ | |
|| echo "Pushing to TugboatQA/dockerfiles: PUSH=$PUSH" | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . && git diff --cached --exit-code || (git commit -m "$GITHUB_RUN_NUMBER" && git push) |