-
Notifications
You must be signed in to change notification settings - Fork 7
99 lines (85 loc) · 3.62 KB
/
display_or_clean_apt.yml
File metadata and controls
99 lines (85 loc) · 3.62 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Display or Clean APT Repository
run-name: APT Repository ${{ inputs.stream }} Codename - ${{ inputs.cleanup == true && 'Clean' || 'Display' }}
on:
workflow_dispatch:
inputs:
stream:
description: 'Choose release'
required: true
type: choice
options:
- beta
- alpha
default: beta
cleanup:
description: 'Erase stream'
type: boolean
required: true
default: false
jobs:
verify_apt:
name: Verify APT Repository - ${{ inputs.stream }} Codename
runs-on: ubuntu-latest
steps:
- name: Install deb-s3
run: |
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.8/deb-s3-0.11.8.gem
sudo gem install deb-s3-0.11.8.gem
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Verify deb-s3 Installation
run: |
deb-s3 verify \
--codename=${{ inputs.stream }} \
--suite=${{ inputs.stream }} \
--s3-region=us-west-2 \
--bucket repo.homebridge.io \
--access-key-id=${{ secrets.AWS_ACCESS_KEY_ID }} \
--secret-access-key=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
--sign=${{ secrets.GPG_KEY_ID }}
display_or_clean_apt:
name: Display or Clean ${{ inputs.stream }} Codename - ${{ inputs.cleanup == true && 'Clean' || 'Display' }}
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Display Current ${{ inputs.stream }} Codename
run: |
aws s3 ls --recursive s3://repo.homebridge.io/dists/${{ inputs.stream }}/ || echo "No ${{ inputs.stream }} codename found"
aws s3 ls --recursive s3://repo.homebridge.io/pool/${{ inputs.stream }}/ || echo "No ${{ inputs.stream }} codename found"
- name: Delete ${{ inputs.stream }} Metadata
if: ${{ inputs.cleanup == true }}
run: |
aws s3 rm s3://repo.homebridge.io/dists/${{ inputs.stream }}/ --recursive
echo "Deleted dists/${{ inputs.stream }}/"
- name: Delete ${{ inputs.stream }} Packages
if: ${{ inputs.cleanup == true }}
run: |
aws s3 rm s3://repo.homebridge.io/pool/${{ inputs.stream }}/ --recursive
echo "Deleted pool/${{ inputs.stream }}/"
- name: Verify Deletion
if: ${{ inputs.cleanup == true }}
run: |
aws s3 ls s3://repo.homebridge.io/dists/${{ inputs.stream }}/ || echo "dists/${{ inputs.stream }}/ is empty"
aws s3 ls s3://repo.homebridge.io/pool/${{ inputs.stream }}/ || echo "pool/${{ inputs.stream }}/ is empty"
- name: Verify Stable Codename
run: |
echo "::Group::Display Stable Codename"
aws s3 ls --recursive s3://repo.homebridge.io/dists/stable/ || echo "No stable codename found"
echo "::endgroup::"
- name: Verify Alpha Codename
run: |
echo "::Group::Display Alpha Codename"
aws s3 ls --recursive s3://repo.homebridge.io/dists/alpha/ || echo "No alpha codename found"
- name: Verify Beta Codename
run: |
echo "::Group::Display Beta Codename"
aws s3 ls --recursive s3://repo.homebridge.io/dists/beta/ || echo "No beta codename found"
echo "::endgroup::"