Plublish 1.9.3 to repository #19
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: Update repository | |
run-name: Plublish ${{ inputs.tag }} to repository | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Release tag name" | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
tag: | |
description: "Release tag name" | |
required: true | |
type: string | |
env: | |
REPOSITORY: gama-platform/gama | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gnupg | |
pip install Jinja2 | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Check if ${{ inputs.tag }} is a pre-release | |
id: pre_release_check | |
run: | | |
body="$(curl https://api.github.com/repos/${{ env.REPOSITORY }}/releases)" | |
pre="$(jq -r 'map(select(.prerelease)) | first | .tag_name' <<< "$body")" | |
echo "pre: $pre" | |
if [[ "${{ inputs.tag }}" == "$pre" ]]; then | |
echo "is_pre_release=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "is_pre_release=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Clear alpha packages from `Packages` file and repository | |
run: | | |
python scripts/clear_alpha_packages.py | |
- name: Download deb file from gama-platform/gama | |
uses: robinraju/[email protected] | |
id: download | |
with: | |
repository: gama-platform/gama | |
tag: ${{ inputs.tag }} | |
fileName: "*.deb" | |
tarBall: false | |
zipBall: false | |
- name: Creating the `Packages`, `Packages.gz` and `Release` files | |
run: | | |
if [[ "${{ steps.pre_release_check.outputs.is_pre_release }}" == "false" ]]; then | |
dpkg-scanpackages --multiversion . > Packages | |
echo '${{ steps.download.outputs.downloaded_files }}' | jq -r '.[]' | while read -r f; do | |
echo file: $f | |
echo run: sed -i "s|Filename: ./$(basename $f)|Filename: ./$(basename $f).html|g" Packages | |
sed -i "s|Filename: ./$(basename $f)|Filename: ./$(basename $f).html|g" Packages | |
done | |
else | |
echo '${{ steps.download.outputs.downloaded_files }}' | jq -r '.[]' | while read -r f; do | |
filename=$(basename $f) | |
dpkg-scanpackages --multiversion $filename > Packages_${filename} | |
echo file: $filename - Packages_${filename} | |
echo run: sed -i "s|Filename: $f|Filename: ./$filename.html|g" Packages_${filename} | |
sed -i "s|Filename: $f|Filename: ./$filename.html|g" Packages_${filename} | |
echo run: sed -i "s|Package: \(.*\)|Package: \1-alpha|g" Packages_${filename} | |
sed -i "s|Package: \(.*\)|Package: \1-alpha|g" Packages_${filename} | |
cat Packages_${filename} | |
done | |
cat Packages_* >> Packages | |
rm Packages_* | |
fi | |
gzip -k -f Packages | |
apt-ftparchive release . > Release | |
- name: Setup redirections to https://github.com/${{ env.REPOSITORY }}/releases/download/${{ inputs.tag }} | |
if: steps.pre_release_check.outputs.is_pre_release == 'false' | |
run: python scripts/setup_redirections.py ${{ env.REPOSITORY }} ${{ inputs.tag }} | |
- name: Setup redirections to https://github.com/${{ env.REPOSITORY }}/releases/download/${{ inputs.tag }} pre-releases | |
if: steps.pre_release_check.outputs.is_pre_release == 'true' | |
run: python scripts/setup_redirections.py -p ${{ env.REPOSITORY }} ${{ inputs.tag }} | |
- name: Updating index and README | |
if: steps.pre_release_check.outputs.is_pre_release == 'false' | |
run: python scripts/setup_index_and_readme.py ${{ inputs.tag }} | |
- name: Updating index and README with pre-release | |
if: steps.pre_release_check.outputs.is_pre_release == 'true' | |
run: python scripts/setup_index_and_readme.py ${{ inputs.tag }} -p '${{ steps.download.outputs.downloaded_files }}' | |
- name: remove downloaded deb files | |
run: rm *.deb | |
- name: Commit new files | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "." | |
author_email: ${{ secrets.BOT_GH_EMAIL }} | |
author_name: ${{ secrets.BOT_GH_NAME }} | |
committer_name: ${{ secrets.BOT_GH_NAME }} | |
committer_email: ${{ secrets.BOT_GH_EMAIL }} | |
github_token: ${{ github.token }} | |
message: "Update repository with gama ${{ inputs.tag }}" | |
push: true |