Skip to content

Commit 05008ba

Browse files
authored
πŸš€ Add-on CI improvements (#86)
1 parent 1c72863 commit 05008ba

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

β€Ž.github/workflows/ci.yamlβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/checkout@v2.3.4
2828
- name: πŸš€ Run add-on information action
2929
id: information
30-
uses: frenck/action-addon-information@v1.2
30+
uses: frenck/action-addon-information@v1.2.2
3131

3232
lint-addon:
3333
name: Lint Add-on
@@ -132,11 +132,9 @@ jobs:
132132
uses: actions/cache@v2.1.6
133133
with:
134134
path: /tmp/.docker-cache
135-
key:
136-
docker-${{ github.ref }}-${{ matrix.architecture }}-${{ github.sha
137-
}}
135+
key: docker-${{ matrix.architecture }}-${{ github.sha }}
138136
restore-keys: |
139-
docker-${{ github.ref }}-${{ matrix.architecture }}
137+
docker-${{ matrix.architecture }}
140138
- name: πŸ— Set up QEMU
141139
uses: docker/setup-qemu-action@v1.2.0
142140
- name: πŸ— Set up Docker Buildx
@@ -186,7 +184,7 @@ jobs:
186184
cache-from: |
187185
type=local,src=/tmp/.docker-cache
188186
ghcr.io/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge
189-
cache-to: type=local,mode=max,dest=/tmp/.docker-cache
187+
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
190188
platforms: ${{ steps.flags.outputs.platform }}
191189
build-args: |
192190
BUILD_ARCH=${{ matrix.architecture }}
@@ -197,3 +195,11 @@ jobs:
197195
BUILD_REF=${{ github.sha }}
198196
BUILD_REPOSITORY=${{ github.repository }}
199197
BUILD_VERSION=edge
198+
# This ugly bit is necessary, or our cache will grow forever...
199+
# Well until we hit GitHub's limit of 5GB :)
200+
# https://github.com/docker/build-push-action/issues/252
201+
# https://github.com/moby/buildkit/issues/1896
202+
- name: 🚚 Swap build cache
203+
run: |
204+
rm -rf /tmp/.docker-cache
205+
mv /tmp/.docker-cache-new /tmp/.docker-cache

β€Ž.github/workflows/deploy.yamlβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/checkout@v2.3.4
3737
- name: πŸš€ Run add-on information action
3838
id: information
39-
uses: frenck/action-addon-information@v1.2
39+
uses: frenck/action-addon-information@v1.2.2
4040
- name: ℹ️ Gather version and environment
4141
id: release
4242
run: |
@@ -75,11 +75,9 @@ jobs:
7575
uses: actions/cache@v2.1.6
7676
with:
7777
path: /tmp/.docker-cache
78-
key:
79-
docker-${{ github.ref }}-${{ matrix.architecture }}-${{ github.sha
80-
}}
78+
key: docker-${{ matrix.architecture }}-${{ github.sha }}
8179
restore-keys: |
82-
docker-${{ github.ref }}-${{ matrix.architecture }}
80+
docker-${{ matrix.architecture }}
8381
- name: πŸ— Set up QEMU
8482
uses: docker/setup-qemu-action@v1.2.0
8583
- name: πŸ— Set up Docker Buildx
@@ -140,7 +138,7 @@ jobs:
140138
cache-from: |
141139
type=local,src=/tmp/.docker-cache
142140
ghcr.io/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge
143-
cache-to: type=local,mode=max,dest=/tmp/.docker-cache
141+
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
144142
platforms: ${{ steps.flags.outputs.platform }}
145143
build-args: |
146144
BUILD_ARCH=${{ matrix.architecture }}
@@ -151,6 +149,14 @@ jobs:
151149
BUILD_REF=${{ github.sha }}
152150
BUILD_REPOSITORY=${{ github.repository }}
153151
BUILD_VERSION=${{ needs.information.outputs.version }}
152+
# This ugly bit is necessary, or our cache will grow forever...
153+
# Well until we hit GitHub's limit of 5GB :)
154+
# https://github.com/docker/build-push-action/issues/252
155+
# https://github.com/moby/buildkit/issues/1896
156+
- name: 🚚 Swap build cache
157+
run: |
158+
rm -rf /tmp/.docker-cache
159+
mv /tmp/.docker-cache-new /tmp/.docker-cache
154160
- name: πŸ” Notarize
155161
# yamllint disable rule:line-length
156162
run: |

β€Ž.github/workflows/pr-labels.yamlβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: PR Labels
33

44
# yamllint disable-line rule:truthy
55
on:
6-
pull_request:
6+
pull_request_target:
77
types: [opened, labeled, unlabeled, synchronize]
88

99
jobs:
@@ -14,6 +14,7 @@ jobs:
1414
- name: 🏷 Verify PR has a valid label
1515
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
1616
with:
17+
pull-request-number: "${{ github.event.pull_request.number }}"
1718
github-token: "${{ secrets.GITHUB_TOKEN }}"
1819
valid-labels: >-
1920
breaking-change, bugfix, documentation, enhancement, refactor,

0 commit comments

Comments
Β (0)