Translates versions to codenames.

More trial-n-error with GitHub actions.
main
tommie 2023-05-12 16:25:01 +02:00 committed by GitHub
parent 0762632d32
commit d6ffba3a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 9 deletions

View File

@ -92,6 +92,19 @@ jobs:
- name: Install Distro Dependencies - name: Install Distro Dependencies
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes dpkg-dev liblzma-dev run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes dpkg-dev liblzma-dev
- name: Translate Codename
id: translate-codename
run: |
case "${{ matrix.os }}" in
22.04) codename=jammy ;;
20.04) codename=focal ;;
*)
echo "Unknown OS: ${{ matrix.os }}" >&2
exit 1
;;
esac
echo "codename=$codename" >>"$GITHUB_OUTPUT"
- name: Download Latest Release - name: Download Latest Release
id: download-release id: download-release
run: | run: |
@ -119,20 +132,26 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: deb command: deb
args: -p client --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ needs.check-upstream.outputs.ubuntu_release }} args: -p client --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.translate-codename.outputs.codename }}
- name: Build Server DEB - name: Build Server DEB
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: deb command: deb
args: -p server --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ needs.check-upstream.outputs.ubuntu_release }} args: -p server --deb-version=${{ needs.check-upstream.outputs.innernet_version }}-0ubuntu0~${{ steps.translate-codename.outputs.codename }}
- name: Upload DEBs - name: Upload DEBs
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: deb-ubuntu-${{ needs.check-upstream.outputs.ubuntu_release }} name: deb-${{ matrix.os }}
path: target/debian/*.deb path: target/debian/*.deb
- name: Show Output
id: show-output
run: |
echo "## Job Outputs" >>"$GITHUB_STEP_SUMMARY"
echo "* \`codename=${{ steps.translate-codename.outputs.codename }}\`" >>"$GITHUB_STEP_SUMMARY"
release: release:
needs: [check-upstream, build-deb] needs: [check-upstream, build-deb]
# Avoid push conflicts. # Avoid push conflicts.
@ -157,6 +176,19 @@ jobs:
echo "${{ secrets.GPG_SIGNING_KEY }}" | gpg --quiet --batch --yes --import echo "${{ secrets.GPG_SIGNING_KEY }}" | gpg --quiet --batch --yes --import
echo '${{ secrets.GPG_SIGNING_PASSPHRASE }}' | /usr/lib/gnupg/gpg-preset-passphrase --preset 57F0E65446A301CC19914FD61167922350A2D8B2 echo '${{ secrets.GPG_SIGNING_PASSPHRASE }}' | /usr/lib/gnupg/gpg-preset-passphrase --preset 57F0E65446A301CC19914FD61167922350A2D8B2
- name: Translate Codename
id: translate-codename
run: |
case "${{ matrix.os }}" in
22.04) codename=jammy ;;
20.04) codename=focal ;;
*)
echo "Unknown OS: ${{ matrix.os }}" >&2
exit 1
;;
esac
echo "codename=$codename" >>"$GITHUB_OUTPUT"
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -164,17 +196,17 @@ jobs:
persist-credentials: false persist-credentials: false
fetch-depth: 0 fetch-depth: 0
- name: Get Artifacts - name: Download DEBs
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: deb-ubuntu-${{ needs.check-upstream.outputs.ubuntu_release }} name: deb-${{ matrix.os }}
path: ./artifacts path: ./artifacts
- name: Import Artifacts - name: Import DEBs
run: | run: |
cd artifacts cd artifacts
for name in *.deb; do for name in *.deb; do
reprepro --export=silent-never -b ../debian includedeb "${{ needs.check-upstream.outputs.ubuntu_release }}" "$name" reprepro --export=silent-never -b ../debian includedeb "${{ steps.translate-codename.outputs.codename }}" "$name"
done done
- name: Update Repository - name: Update Repository
@ -184,7 +216,7 @@ jobs:
} }
if has_changes debian/pool; then if has_changes debian/pool; then
reprepro -b debian export "${{ needs.check-upstream.outputs.ubuntu_release }}" reprepro -b debian export "${{ steps.translate-codename.outputs.codename }}"
fi fi
if has_changes debian/{db,dists,pool}; then if has_changes debian/{db,dists,pool}; then
@ -192,7 +224,7 @@ jobs:
git \ git \
-c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \ -c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
-c 'user.name=github-actions[bot]' \ -c 'user.name=github-actions[bot]' \
commit -m "Included release tonarino/innernet@${{ needs.check-upstream.outputs.innernet_release }} in ${{ needs.check-upstream.outputs.ubuntu_release }}." commit -m "Included release tonarino/innernet@${{ needs.check-upstream.outputs.innernet_release }} in ${{ steps.translate-codename.outputs.codename }}."
else else
echo 'No updates to commit.' echo 'No updates to commit.'
fi fi