-
Notifications
You must be signed in to change notification settings - Fork 2
160 lines (160 loc) · 7.96 KB
/
continuous.yaml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Continuous
on:
push:
branches:
- master
schedule:
- cron: '0 */6 * * *'
workflow_dispatch: {}
permissions:
contents: read
id-token: write
packages: write
jobs:
pre:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-matrix.outputs.matrix }}
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: aws configure
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/xcode
- name: install and setup dependencies
run: |
sudo cp ./hack/unttify.py /usr/local/bin/unttify
sudo sh ./hack/unttify.sh skopeo
sudo sh ./hack/debian-install-xar-devel.sh
pipx install pipenv
- name: build matrix
id: build-matrix
run: |
make -C matrix
echo "::set-output name=matrix::$(cat ./matrix/matrix.json)"
- name: build tgzarmorer
run: make -C tgzarmorer build
- name: upload tgzarmorer
uses: actions/upload-artifact@v3
with:
name: tgzarmorer
path: ./tgzarmorer/tgza
retention-days: 1
- name: build xipverifier
run: make -C xipverifier build
- name: upload xipverifier
uses: actions/upload-artifact@v3
with:
name: xipverifier
path: ./xipverifier/xv
retention-days: 1
- name: bake cookies
run: make 'GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}' -C cookiebaker
env:
APPLEID_USER: ${{ secrets.APPLEID_USER }}
APPLEID_PASS: ${{ secrets.APPLEID_PASS }}
AWSS3_BUCKETNAME: ${{ secrets.AWSS3_BUCKETNAME }}
MESSAGEBIRD_ACCESSKEY: ${{ secrets.MESSAGEBIRD_ACCESSKEY }}
MESSAGEBIRD_CALLER: ${{ secrets.MESSAGEBIRD_CALLER }}
MESSAGEBIRD_CALLEE: ${{ secrets.MESSAGEBIRD_CALLEE }}
- name: upload cookies
uses: actions/upload-artifact@v3
with:
name: cookiebaker
path: ./cookiebaker/cookies.txt.gpg
retention-days: 1
make:
runs-on: ubuntu-latest
needs: pre
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.pre.outputs.matrix) }}
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
XDG_RUNTIME_DIR: /tmp
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: download artifacts
uses: actions/download-artifact@v3
- name: aws configure
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/xcode
- name: install and setup dependencies
run: |
sudo cp ./hack/unttify.py /usr/local/bin/unttify
sudo sh ./hack/unttify.sh aria2c
sudo sh ./hack/unttify.sh skopeo
sudo sh ./hack/apple-pki.sh
sudo sh ./hack/debian-install-xar-devel.sh
sudo make -C tgzarmorer install
sudo make -C xipverifier install
- name: docker login
run: |
skopeo login -u '${{ secrets.DOCKERHUB_USER }}' -p '${{ secrets.DOCKERHUB_PASS }}' docker.io
skopeo login -u '${{ secrets.QUAY_USER }}' -p '${{ secrets.QUAY_PASS }}' quay.io
skopeo login -u '${{ github.actor }}' -p '${{ github.token }}' ghcr.io
skopeo login -u 'AWS' -p "$(aws ecr-public get-login-password)" public.ecr.aws
- name: docker inspect
id: docker-inspect
run: |
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://docker.io/inloco/xcode:${{ matrix.build }}' || echo "::set-output name=needs-build::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://docker.io/inloco/xcode:${{ matrix.version }}' || echo "::set-output name=needs-version::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://quay.io/inloco/xcode:${{ matrix.build }}' || echo "::set-output name=needs-build::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://quay.io/inloco/xcode:${{ matrix.version }}' || echo "::set-output name=needs-version::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://ghcr.io/inloco/xcode:${{ matrix.build }}' || echo "::set-output name=needs-build::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://ghcr.io/inloco/xcode:${{ matrix.version }}' || echo "::set-output name=needs-version::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://public.ecr.aws/incognia/xcode:${{ matrix.build }}' || echo "::set-output name=needs-build::1"
skopeo inspect --override-os 'darwin' --override-arch 'universal' --raw 'docker://public.ecr.aws/incognia/xcode:${{ matrix.version }}' || echo "::set-output name=needs-version::1"
- name: decrypt cookies
if: ${{ steps.docker-inspect.outputs.needs-build }}
run: make 'GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}' -C cookiebaker decrypt
- name: download xcode
if: ${{ steps.docker-inspect.outputs.needs-build }}
run: make 'URL=${{ matrix.url }}' Xcode.xip.tgz
- name: docker build
if: ${{ steps.docker-inspect.outputs.needs-build }}
run: |
export OCIREV='${{ matrix.build }}'
export OCITIT='${{ matrix.name }}'
export OCIURL='${{ matrix.url }}'
export OCIVER='${{ matrix.version }}'
make -C oci build
- name: docker push build
if: ${{ steps.docker-inspect.outputs.needs-build }}
shell: '/usr/bin/env parallel --lb :::: {0}'
run: |
make 'IMAGE_REGISTRY=docker.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.build }}' -C oci push
make 'IMAGE_REGISTRY=quay.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.build }}' -C oci push
make 'IMAGE_REGISTRY=ghcr.io' 'IMAGE_REPOSITORY=${{ github.repository }}' 'IMAGE_VERSION=${{ matrix.build }}' -C oci push
make 'IMAGE_REGISTRY=public.ecr.aws' 'IMAGE_REPOSITORY=incognia/xcode' 'IMAGE_VERSION=${{ matrix.build }}' -C oci push
- name: docker tag version
if: ${{ steps.docker-inspect.outputs.needs-version }}
shell: '/usr/bin/env parallel --lb :::: {0}'
run: |
make 'IMAGE_REGISTRY=docker.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.build }}' 'IMAGE_TAG=${{ matrix.version }}' -C oci tag
make 'IMAGE_REGISTRY=quay.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.build }}' 'IMAGE_TAG=${{ matrix.version }}' -C oci tag
make 'IMAGE_REGISTRY=ghcr.io' 'IMAGE_REPOSITORY=${{ github.repository }}' 'IMAGE_VERSION=${{ matrix.build }}' 'IMAGE_TAG=${{ matrix.version }}' -C oci tag
make 'IMAGE_REGISTRY=public.ecr.aws' 'IMAGE_REPOSITORY=incognia/xcode' 'IMAGE_VERSION=${{ matrix.build }}' 'IMAGE_TAG=${{ matrix.version }}' -C oci tag
- name: docker tag latest
if: ${{ matrix.latest }}
shell: '/usr/bin/env parallel --lb :::: {0}'
run: |
make 'IMAGE_REGISTRY=docker.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.version }}' 'IMAGE_TAG=latest' -C oci tag
make 'IMAGE_REGISTRY=quay.io' 'IMAGE_REPOSITORY=inloco/xcode' 'IMAGE_VERSION=${{ matrix.version }}' 'IMAGE_TAG=latest' -C oci tag
make 'IMAGE_REGISTRY=ghcr.io' 'IMAGE_REPOSITORY=${{ github.repository }}' 'IMAGE_VERSION=${{ matrix.version }}' 'IMAGE_TAG=latest' -C oci tag
make 'IMAGE_REGISTRY=public.ecr.aws' 'IMAGE_REPOSITORY=incognia/xcode' 'IMAGE_VERSION=${{ matrix.version }}' 'IMAGE_TAG=latest' -C oci tag