-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (98 loc) · 3.07 KB
/
deploy.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
name: Build repository and deploy
on:
push:
branches: [ "master" ]
workflow_dispatch:
inputs:
skip_upload:
required: false
description: "Skip upload"
type: boolean
default: false
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "deploy"
cancel-in-progress: false
env:
BASE_REPO_URL: https://bboozzoo.github.io/snapd-amazon-linux
jobs:
build-repo:
strategy:
matrix:
target: ["amazonlinux:2", "amazonlinux:2023"]
include:
- target: amazonlinux:2
artifact_name: repo-tarball-amazonlinux-2
repo_tarball_name: amazon-linux-2-repo.tar.xz
repo_url_suffix: amzn2
- target: amazonlinux:2023
artifact_name: repo-tarball-amazonlinux-2023
repo_tarball_name: amazon-linux-2023-repo.tar.xz
repo_url_suffix: al2023
runs-on: ubuntu-latest
container: ${{ matrix.target }}
env:
# see the comment in buildrepo workflow
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.target == 'amazonlinux:2' && 'true' || '' }}
steps:
- name: Install git
run: |
yum install git -y
- name: Checkout code
uses: actions/checkout@v3
- name: Build repository artifacts
id: build-repo
uses: "./.github/actions/build-repo"
with:
target: ${{ matrix.target }}
repo_tarball_name: ${{ matrix.repo_tarball_name }}
repo_artifact_name: ${{ matrix.artifact_name }}
repo_url: ${{ env.BASE_REPO_URL }}/${{ matrix.repo_url_suffix }}
deploy:
needs:
- build-repo
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- uses: actions/download-artifact@v3
- name: Prepare the artifacts
run: |
set -ex
find . -ls
mkdir -p repo/amzn2 repo/al2023
tar -C repo/amzn2 --strip-components=1 -xvf repo-tarball-amazonlinux-2/amazon-linux-2-repo.tar.xz
tar -C repo/al2023 --strip-components=1 -xvf repo-tarball-amazonlinux-2023/amazon-linux-2023-repo.tar.xz
# generate index.html in each directory so that we can browse the paths
(
cd repo/
LC_ALL=C find . -type d -print -exec sh -c 'tree "$0" \
-H "." \
-L 1 \
--noreport \
--dirsfirst \
--charset utf-8 \
-I "index.html" \
--ignore-case \
--timefmt "%d-%b-%Y %H:%M" \
-s \
-D \
-o "$0/index.html"' {} \;
)
find repo/ -ls
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'repo/'
- name: Deploy to GitHub Pages
# only on master or manual trigger
if: ${{ contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && !inputs.skip_upload }}
id: deployment
uses: actions/deploy-pages@v4