Merge pull request #14 from bboozzoo/bboozzoo/pages-repo #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build repository | |
on: | |
pull_request: | |
branches: [ "master"] | |
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: "packaging" | |
cancel-in-progress: false | |
jobs: | |
build-repo: | |
strategy: | |
matrix: | |
target: ["amazonlinux:2", "amazonlinux:2023"] | |
include: | |
- target: amazonlinux:2 | |
artifact_name: repo-tarball-amazonlinux-2 | |
- target: amazonlinux:2023 | |
artifact_name: repo-tarball-amazonlinux-2023 | |
runs-on: ubuntu-latest | |
container: ${{ matrix.target }} | |
steps: | |
- name: Install git | |
run: | | |
yum install git -y | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build RPM packages | |
run: | | |
IN_CONTAINER=1 ./tool build | |
- name: Build repository tarball | |
run: | | |
IN_CONTAINER=1 ./tool createrepo | |
case ${{ matrix.target }} in | |
amazonlinux:2) | |
repo_file=amazon-linux-2-repo.tar.xz | |
;; | |
amazonlinux:2023) | |
repo_file=amazon-linux-2023-repo.tar.xz | |
;; | |
*) | |
echo "unsupported target ${{ matrix.target }}" | |
exit 1 | |
;; | |
esac | |
tar -cJv repo > "$repo_file" | |
- name: Uploading repository tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: "amazon-linux-*-repo*.tar.xz" | |
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@v4 | |
with: | |
name: repo-tarball-amazonlinux-2 | |
path: repo/amzn2 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repo-tarball-amazonlinux-2023 | |
path: repo/al2023 | |
- name: Show the artifacts | |
run: | | |
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 |