Skip to content

Commit

Permalink
ci: Add cache cleanup workflows (#65)
Browse files Browse the repository at this point in the history
* Update mlc_config.json

* Add cache cleaning scripts

* Remove duplicate linter

* Update tag format

* Add setup go

* Ignore resolver itself
  • Loading branch information
ankurdotb authored Nov 8, 2022
1 parent 9dc906a commit 1e1541f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .github/linters/mlc_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"aliveStatusCodes": [0, 200, 206, 403, 999, 406]
"aliveStatusCodes": [0, 200, 206, 429, 403, 501, 999],
"ignorePatterns": [
{
"pattern": "^https://resolver.cheqd.net/"
}
]
}
24 changes: 24 additions & 0 deletions .github/workflows/cleanup-cache-automatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Cache Cleanup - Automatic"
on:
pull_request:
types:
- closed
defaults:
run:
shell: bash


jobs:

cache-purge:
name: "Purge Actions cache"
runs-on: ubuntu-latest

steps:

- name: "Delete Branch Cache Action"
uses: snnaplab/delete-branch-cache-action@v1.0.0
with:
# Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
ref: refs/pull/${{ github.event.number }}/merge
github-token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Cleanup - Cache"
name: "Cache Cleanup - Manual"
on:
workflow_dispatch:
inputs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
call-lint:
name: "Lint"
uses: ./.github/workflows/lint.yml
secrets: inherit

call-build:
name: "Build"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ jobs:
VALIDATE_MARKDOWN: true
VALIDATE_OPENAPI: true
VALIDATE_PYTHON_PYLINT: true
VALIDATE_XML: true
VALIDATE_YAML: true
20 changes: 5 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- uses: actions/setup-go@v3
with:
go-version-file: ./go.mod
cache: true

- name: "Obtain Github App token"
id: app-token
uses: getsentry/action-github-app-token@v2.0.0
Expand Down Expand Up @@ -136,18 +141,3 @@ jobs:

- name: Push image to DigitalOcean Container Registry
run: docker image push --all-tags registry.digitalocean.com/${{ github.repository }}

cache-purge:
name: "Purge branch Actions cache"
needs: [release-binary, release-docker]
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest

steps:

- name: "Delete Branch Cache Action"
uses: snnaplab/delete-branch-cache-action@v1.0.0
with:
# Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
ref: refs/pull/${{ github.event.number }}/merge
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"prerelease": true
}
],
"tagFormat": "${version}",
"tagFormat": "v${version}",
"ci": true,
"preset": "conventionalcommits",
"plugins": [
Expand Down

0 comments on commit 1e1541f

Please sign in to comment.