This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
Repacking cgpt and vboot-utils #125
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: Repacking cgpt and vboot-utils | |
on: | |
schedule: | |
- cron: "20 0 * * *" # run at the start of every day after utils and system packages are released | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
public_key: ${{ secrets.PUBLIC }} | |
private_key: ${{ secrets.PRIVATE }} | |
jobs: | |
check-name: | |
runs-on: ubuntu-latest | |
outputs: | |
match_results: ${{ steps.check-names.outputs.match_results }} | |
vboot_remote_name: ${{ steps.check-names.outputs.vboot_remote_name }} | |
cgpt_remote_name: ${{ steps.check-names.outputs.cgpt_remote_name }} | |
steps: | |
- name: Checking out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Check if remote debs were updated | |
id: check-names | |
run: | | |
# Download remote deb packages | |
apt-get download cgpt vboot-kernel-utils | |
# for some reason the sha256sum changes every time -> use package name instead | |
vboot_latest_name=$(ls | grep vboot-kernel-utils*.deb) | |
cgpt_latest_name=$(ls | grep cgpt*.deb) | |
# Check remote names against cached ones | |
vboot_match_results=$([[ "$(cat cache/deb_name-cache.txt | head -1)" == "$vboot_latest_name" ]] && echo "true" || echo "false") | |
cgpt_match_results=$([[ "$(cat cache/deb_name-cache.txt | tail -1)" == "$cgpt_latest_name" ]] && echo "true" || echo "false") | |
# Compare results and determine if there was an update for any of the debs | |
if [[ "$vboot_match_results" == "true" && "$cgpt_match_results" == "true" ]]; then | |
echo "match_results=true" >> $GITHUB_OUTPUT | |
else | |
echo "match_results=false" >> $GITHUB_OUTPUT | |
fi | |
# Add names to output | |
echo "vboot_remote_name=$vboot_latest_name" >> $GITHUB_OUTPUT | |
echo "cgpt_remote_name=$cgpt_latest_name" >> $GITHUB_OUTPUT | |
repackage-debs: | |
runs-on: ubuntu-latest | |
needs: check-name # needs for the vars from the previous job | |
# Only run script when a remote name has changed, aka the results DON'T match | |
if: needs.check-name.outputs.match_results == 'false' | |
steps: | |
- name: Checking out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Update local cache file | |
run: | | |
echo "${{ needs.check-name.outputs.vboot_remote_name }}"$'\n'"${{ needs.check-name.outputs.cgpt_remote_name }}" > cache/deb_name-cache.txt | |
- name: Install pacman | |
run: | | |
# Add ubuntu 22.10 repo to sources | |
echo "deb http://archive.ubuntu.com/ubuntu mantic main universe" | sudo tee -a /etc/apt/sources.list | |
# Update apt sources | |
sudo apt-get update | |
# Install pacman-package-manager from ubuntu 22.10 repo | |
sudo apt-get -y install pacman-package-manager libarchive-tools | |
# Set author in makepkg.conf | |
echo 'PACKAGER="The Eupnea Project <https://github.com/eupnea-project>"' | sudo tee -a /etc/makepkg.conf | |
- name: Bump version in pkgbuild file | |
run: | | |
CURRENT_VERSION=$(sed -n '3p' pkgbuild-files/cgpt_vboot.pkgbuild | sed 's/.*://' | xargs) # get current version from control file | |
NEXTVERSION=$(echo ${CURRENT_VERSION} | awk -F. -v OFS=. '{$NF += 1 ; print}') # bump version | |
sed -i "3s/.*/${NEXTVERSION}/" pkgbuild-files/cgpt_vboot.pkgbuild # update version in control file | |
- name: Repacking cgpt-vboot package | |
run: | | |
cp pkgbuild-files/cgpt_vboot.pkgbuild . # makepkg needs the pkgbuild file in the current directory | |
makepkg --nodeps -p cgpt_vboot.pkgbuild | |
- name: Downloading old repo | |
run: | | |
# Download old repo. | |
# Exit in case the branch doesn't exist yet | |
git clone --branch=gh-pages https://github.com/eupnea-project/arch-repo /tmp/arch-repo || exit 0 | |
# Copy old repo to current directory | |
cp -r /tmp/arch-repo/repodata . | |
# Delete old cgpt-vboot packages | |
rm -rf repodata/x86_64/cgpt-vboot-utils*.pkg.tar.gz | |
# Delete all signatures | |
rm -rf repodata/x86_64/*.sig | |
- name: Setting up arch repo | |
run: bash create-repo.sh | |
- name: Updating files in repository | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
# Disable setting repo owner as commit author | |
commit_user_name: github-actions[bot] | |
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com | |
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
# Optional. Commit message for the created commit. | |
# Defaults to "Apply automatic changes" | |
commit_message: Update files in main branch | |
file_pattern: 'pkgbuild-files/cgpt_vboot.pkgbuild cache/deb_name-cache.txt' | |
- name: Deploying cgpt-vboot-utils package | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
# Disable setting repo owner as commit author | |
commit_user_name: github-actions[bot] | |
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com | |
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
# Optional. Commit message for the created commit. | |
# Defaults to "Apply automatic changes" | |
commit_message: Deploy cgpt-vboot-utils package | |
branch: gh-pages | |
create_branch: true | |
# Only include needed files | |
file_pattern: 'repodata/* public_key.gpg' | |
push_options: '--force' | |
- name: Generating release tag | |
id: tag | |
run: | | |
echo "::set-output name=release_tag::$(date +"%Y.%m.%d_%H-%M")" | |
- name: Rename cgpt-vboot-utils | |
run: mv ./cgpt-vboot-utils*.pkg.tar.gz ./cgpt-vboot-utils.pkg.tar.gz | |
- name: Creating new release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
name: Automated cgpt-vboot-utils package creation - ${{ steps.tag.outputs.release_tag }} | |
body: | | |
These are repackaged ubuntu deb packages for arch. | |
files: | | |
./cgpt-vboot-utils.pkg.tar.gz |