Skip to content

Commit

Permalink
ci: use docker registry as docker cache to speedup build (#31)
Browse files Browse the repository at this point in the history
* ci: use docker registry as docker cache to speedup build

* ci: add cache to docker hub instead of local file.
  • Loading branch information
shiipou committed Feb 1, 2022
1 parent 8dd94cf commit 66f2094
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -xe # Show output on the logs
function get_tag {
version="$1" # Get version tag
DOCKER_IMAGE="$2"

regex='([0-9]+.[0-9]+.[0-9]+)(-([a-z]+).([0-9]+))?'

if [[ $version =~ $regex ]]; then
v="${BASH_REMATCH[1]}"
channel="${BASH_REMATCH[3]}"
Expand Down Expand Up @@ -55,10 +55,10 @@ fi
# build the docker image
docker buildx build \
--output type=image,push=true \
--platform "amd64,arm64,arm" \
--platform "linux/amd64,linux/arm64,linux/arm" \
${tag} \
--build-arg CI=true \
--build-arg GH_PERSONNAL_TOKEN="${GITHUB_TOKEN}" \
--cache-from type=local,src=~/.docker-cache \
--cache-to type=local,dest=~/.docker-cache \
--cache-from type=registry,ref=${DOCKER_IMAGE}-buildcache \
--cache-to type=registry,ref=${DOCKER_IMAGE}-buildcache,mode=max \
.
9 changes: 1 addition & 8 deletions .github/workflows/semantic_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 25
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -24,18 +24,11 @@ jobs:
node-version: "14"
- name: Setup node deps
run: npm i conventional-changelog-conventionalcommits@4 @semantic-release/exec @semantic-release/git -D
- name: Setup node deps
run: npm i conventional-changelog-conventionalcommits@4 @semantic-release/exec @semantic-release/git -D
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache docker build
uses: actions/cache@v2
with:
path: ~/.docker-cache
key: ${{ runner.os }}-docker
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_PERSONNAL_TOKEN }}
Expand Down

0 comments on commit 66f2094

Please sign in to comment.