Skip to content

Commit

Permalink
Update deploy & release workflows to use Docker Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
damacus committed Nov 2, 2020
1 parent 04f0651 commit 5ab9c36
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 81 deletions.
120 changes: 70 additions & 50 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,84 @@ on:
- master
- develop
schedule:
- cron: '59 23 * * *'
- cron: "59 23 * * *"

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 ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- 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
run: docker buildx build -f Dockerfile -t ${ORG}/github-runner:latest --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${ORG}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile

ubuntu_bionic_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- 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
run: 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: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- 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: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${ORG}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-bionic

ubuntu_xenial_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- 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-xenial; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-xenial -t ${ORG}/github-runner:ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${ORG}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-xenial
83 changes: 52 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,70 +21,91 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

ubuntu_latest_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
uses: docker/setup-buildx-action@v1
with:
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
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
run: docker buildx build -f Dockerfile -t ${ORG}/github-runner:${TAG} --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
push: true
tags: ${ORG}/github-runner:${TAG}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile

ubuntu_bionic_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
uses: docker/setup-buildx-action@v1
with:
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- 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
run: docker buildx build -f Dockerfile.ubuntu-bionic -t ${ORG}/github-runner:${TAG}-ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${ORG}/github-runner:${TAG}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-bionic

ubuntu_xenial_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
- name: Set up Docker
uses: docker/setup-buildx-action@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
version: latest
install: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-xenial -t ${ORG}/github-runner:${TAG}-ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm64 .
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${ORG}/github-runner:${TAG}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-xenial

0 comments on commit 5ab9c36

Please sign in to comment.