Skip to content

Commit

Permalink
Clean-up github actions to use official actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Firefishy committed Mar 23, 2022
1 parent 9a4c968 commit 500dae9
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 199 deletions.
142 changes: 77 additions & 65 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,64 @@ on:
schedule:
- cron: '0 22 * * *'


jobs:
ubuntu_base_latest_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile.base -t ${ORG}/github-runner-base:latest --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.base
pull: true
push: true
tags: ${ORG}/github-runner-base:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

ubuntu_base_bionic_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.base.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile.base.ubuntu-bionic -t ${ORG}/github-runner-base:ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.base.ubuntu-bionic
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.base.ubuntu-bionic
pull: true
push: true
tags: ${ORG}/github-runner-base:ubuntu-bionic
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max

debian_base_deploy:
runs-on: ubuntu-latest
Expand All @@ -68,25 +76,29 @@ jobs:
release: [bullseye, sid]
fail-fast: false
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.debian-${{ matrix.release }}; sed -i.bak 's/FROM.*/FROM debian:${{ matrix.release }}/' Dockerfile.base.debian-${{ matrix.release }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile.base.debian-${{ matrix.release }} -t ${ORG}/github-runner-base:debian-${{ matrix.release }} --output "type=image,push=true" --platform linux/amd64,linux/arm64,linux/arm/v7 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.debian-${{ matrix.release }}; sed -i.bak 's/FROM.*/FROM debian:${{ matrix.release }}/' Dockerfile.base.debian-${{ matrix.release }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.base.debian-${{ matrix.release }}
pull: true
push: true
tags: ${ORG}/github-runner-base:debian-${{ matrix.release }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
141 changes: 77 additions & 64 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,60 @@ jobs:
ubuntu_latest_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile -t ${ORG}/github-runner:latest --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
pull: true
push: true
tags: ${ORG}/github-runner:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

ubuntu_bionic_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile.ubuntu-bionic -t ${ORG}/github-runner:ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.ubuntu-bionic
pull: true
push: true
tags: ${ORG}/github-runner:ubuntu-bionic
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max

debian_deploy:
runs-on: ubuntu-latest
Expand All @@ -67,25 +76,29 @@ jobs:
release: [bullseye, sid]
fail-fast: false
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.debian-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:debian-${{ matrix.release }}/" Dockerfile.debian-${{ matrix.release }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: nick-invision/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 120
command: docker buildx build -f Dockerfile.debian-${{ matrix.release }} -t ${ORG}/github-runner:debian-${{ matrix.release }} --output "type=image,push=true" --platform linux/amd64,linux/arm64,linux/arm/v7 .
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo 'ORG='$(dirname ${GITHUB_REPOSITORY}) >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.debian-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:debian-${{ matrix.release }}/" Dockerfile.debian-${{ matrix.release }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.debian-${{ matrix.release }}
pull: true
push: true
tags: ${ORG}/github-runner:debian-${{ matrix.release }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
Loading

0 comments on commit 500dae9

Please sign in to comment.