Skip to content

github: fix artifact download and prepare steps #45

github: fix artifact download and prepare steps

github: fix artifact download and prepare steps #45

Workflow file for this run

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"
retention-days: 1
download-artifacts:
needs:
- build-repo
runs-on: ubuntu-latest
steps:
# XXX must be the same download-artifact action version as upload-artifact
# downloads all aritfacts
- uses: actions/download-artifact@v3
- name: Show the artifacts
run: |
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
find repo/ -ls
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: |
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
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