Skip to content

feat: Add cleanup function to start.sh #9

feat: Add cleanup function to start.sh

feat: Add cleanup function to start.sh #9

Workflow file for this run

name: Pipeline
on:
push:
paths:
- "src/**"
- ".github/workflows/**"
pull_request:
paths:
- "src/**"
- ".github/workflows/**"
env:
version: 1.0.${{github.run_number}}
imageRepository: "emberstack/github-actions-runner"
DOCKER_CLI_EXPERIMENTAL: "enabled"
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: "docker - build PR"
if: github.event_name == 'pull_request'
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64 -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker
docker buildx build --platform linux/arm -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker
docker buildx build --platform linux/arm64 -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker
- name: tools - docker - login
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: docker/login-action@v1
with:
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
- name: "docker - build and publish"
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
docker buildx build --push --platform linux/amd64 --provenance=false -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker
docker buildx build --push --platform linux/arm --provenance=false -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker
docker buildx build --push --platform linux/arm64 --provenance=false -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker
docker pull --platform linux/amd64 ${{env.imageRepository}}:build-${{env.version}}-amd64
docker pull --platform linux/arm/v7 ${{env.imageRepository}}:build-${{env.version}}-arm32v7
docker pull --platform linux/arm64 ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest create ${{env.imageRepository}}:build-${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest inspect ${{env.imageRepository}}:build-${{env.version}}
docker manifest push ${{env.imageRepository}}:build-${{env.version}}
cd:
name: CD
needs: ci
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: tools - docker - login
uses: docker/login-action@v1
with:
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}
- name: "docker - tag and push"
run: |
docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm32v7
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest create ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest create ${{env.imageRepository}}:latest ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest push ${{env.imageRepository}}:${{env.version}}
docker manifest push ${{env.imageRepository}}:latest
docker manifest push ${{env.imageRepository}}:${{env.version}}
docker manifest push ${{env.imageRepository}}:latest
docker tag ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:${{env.version}}-amd64
docker tag ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:${{env.version}}-arm32v7
docker tag ${{env.imageRepository}}:build-${{env.version}}-arm64v8 ${{env.imageRepository}}:${{env.version}}-arm64v8
docker push ${{env.imageRepository}}:${{env.version}}-amd64
docker push ${{env.imageRepository}}:${{env.version}}-arm32v7
docker push ${{env.imageRepository}}:${{env.version}}-arm64v8
- name: github - create release
uses: softprops/action-gh-release@v1
with:
repository: emberstack/docker-github-actions-runner
tag_name: v${{env.version}}
body: The release process is automated.
token: ${{ secrets.ES_GITHUB_PAT }}