Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

ci: remove docker from automated release workflow #3547

Merged
merged 29 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
416783e
add action to publish to docker
MicaiahReid Aug 16, 2022
c9e24f8
add test workflow to call docker publish action
MicaiahReid Aug 16, 2022
b78791a
change path to action
MicaiahReid Aug 16, 2022
1d5ce75
rename action maybe?
MicaiahReid Aug 16, 2022
ed124fa
try changing path again
MicaiahReid Aug 16, 2022
d58e3cc
try stuff
MicaiahReid Aug 16, 2022
12266b8
oops I committed the wrong thing last time
MicaiahReid Aug 16, 2022
0ed038d
try this
MicaiahReid Aug 16, 2022
17f22d3
test this
MicaiahReid Aug 16, 2022
032c59a
ooo try this
MicaiahReid Aug 16, 2022
88eab39
change how inputs are referenced
MicaiahReid Aug 16, 2022
327e0b8
test secrets
MicaiahReid Aug 16, 2022
8040c5f
test again
MicaiahReid Aug 16, 2022
fa97f00
test
MicaiahReid Aug 16, 2022
f794049
put code back, add new input parameters
MicaiahReid Aug 16, 2022
76e790d
pass docker parameters
MicaiahReid Aug 16, 2022
c631bf9
pass _correct_ docker parameters
MicaiahReid Aug 16, 2022
e3b4637
npm ci first
MicaiahReid Aug 16, 2022
4d22691
clean up action
MicaiahReid Aug 16, 2022
910fb14
pass env variables correctly
MicaiahReid Aug 16, 2022
01b94d2
test renaming action file
MicaiahReid Aug 16, 2022
9ff9ce2
specify exact file maybe?
MicaiahReid Aug 16, 2022
41e775f
rename, pput in folder
MicaiahReid Aug 16, 2022
9534123
call publish-docker action correctly in release
MicaiahReid Aug 16, 2022
39c648f
add comment
MicaiahReid Aug 16, 2022
4ccd6e9
remove test file
MicaiahReid Aug 16, 2022
eb71773
fix comment
MicaiahReid Aug 18, 2022
f349431
Apply suggestions from code review
MicaiahReid Aug 23, 2022
bf53d6a
Apply suggestions from code review
MicaiahReid Aug 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/actions/docker-publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "Docker Publish"
description: "Builds and publishes a Docker image for the Ganache repo."
inputs:
VERSION:
description: "The release version to be tagged to the Docker image, e.g., 4.0.1"
required: true
TAG:
description: "The tag to be tagged to the Docker image, e.g., latest."
required: true
DOCKER_USERNAME:
description: "Username to log in to Docker hub."
required: true
DOCKER_ACCESS_TOKEN:
description: "Access token to log in to Docker hub."
required: true
GITHUB_TOKEN:
description: "Github token used to log in to the container registry."
required: true
INFURA_KEY:
description: "Infura key used to build Ganache within the Docker image."
required: true
runs:
# "composite" means we are using yml (rather than js or docker) for our action
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Use npm 14
uses: actions/setup-node@v1
with:
node-version: 14

- name: Run installation
run: npm ci
shell: bash
davidmurdoch marked this conversation as resolved.
Show resolved Hide resolved

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ inputs.DOCKER_USERNAME }}
password: ${{ inputs.DOCKER_ACCESS_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
trufflesuite/ganache
ghcr.io/${{ github.repository}}

- name: Set up QEMU
uses: docker/setup-qemu-action@0522dcd2bf084920c411162fde334a308be75015

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@91cb32d715c128e5f0ede915cd7e196ab7799b83

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./src/packages/ganache/Dockerfile
push: true
tags: ${{ format('trufflesuite/ganache:{0}, trufflesuite/ganache:v{1}', inputs.TAG, inputs.VERSION) }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64/v8,linux/amd64
build-args: |
INFURA_KEY=${{ inputs.INFURA_KEY }}
62 changes: 22 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,49 +149,31 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# publish to docker and github packages
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
trufflesuite/ganache
ghcr.io/${{ github.repository}}

- name: Set up QEMU
uses: docker/setup-qemu-action@0522dcd2bf084920c411162fde334a308be75015

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@91cb32d715c128e5f0ede915cd7e196ab7799b83

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./src/packages/ganache/Dockerfile
push: true
tags: ${{ format('trufflesuite/ganache:{0}, trufflesuite/ganache:v{1}', env.TAG, env.VERSION) }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64/v8,linux/amd64
build-args: |
INFURA_KEY=${{ secrets.INFURA_KEY }}

- name: Merge changes back into develop for latest release (master)
if: ${{ env.TAG == 'latest' }}
run: |
git checkout develop
git merge origin/master
git push origin develop

publish-docker:
needs: release
runs-on: ubuntu-20.04
steps:
# because the docker publish action is an action we made, we have to
# check out the repo
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Ganache's docker publish action
# we are running our local action, so point directly to a folder
# containing an `action.yml` file
uses: ./.github/actions/docker-publish
with:
VERSION: ${{ env.VERSION }}
TAG: ${{ env.TAG }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
INFURA_KEY: ${{ secrets.INFURA_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}