-
Notifications
You must be signed in to change notification settings - Fork 55
43 lines (36 loc) · 1.19 KB
/
delete-branch-snapshot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Delete Snapshot on Branch Deletion
on:
delete:
branches:
- "**"
jobs:
delete-snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Cache delete-snapshot binary
id: cache-delete-snapshot
uses: actions/cache@v4
with:
path: |
./build
key: ${{ runner.os }}-delete-snapshot-${{ hashFiles('cmd/delete-snapshot/*.go') }}
- name: Build delete-snapshot binary
if: steps.cache-delete-snapshot.outputs.cache-hit != 'true'
run: |
make build-delete-snapshot
- name: Run delete-snapshot
env:
R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }}
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
run: |
SANITIZED_EVENT_REF=${{ github.event.ref }}
SANITIZED_EVENT_REF=$(echo "$SANITIZED_EVENT_REF" | sed 's|refs/heads/||; s|/|_|g')
./build/delete-snapshot "$SANITIZED_EVENT_REF"