Simplify reprepro using new composite action (#1320)

This commit is contained in:
Michael Telatynski 2023-11-22 08:31:25 +00:00 committed by GitHub
parent 06df6e97fe
commit ea22bcf1eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 74 deletions

View file

@ -108,8 +108,6 @@ jobs:
sqlcipher: static
version: ${{ needs.prepare.outputs.nightly-version }}
# This deploy job only handles Windows, macOS & linux_static as those are stateless and static.
# Linux will be deployed via reprepro after it, but we list it as a dependency to abort if it fails.
deploy:
needs:
- prepare
@ -130,9 +128,6 @@ jobs:
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: packages.element.io
path: packages.element.io
- name: Deploy artifacts
run: |
@ -150,23 +145,31 @@ jobs:
repository: vector-im/packages.element.io
event-type: packages-index
reprepro:
needs:
- linux
# We queue this after the other deploy stage as we want to abort if that fails
- deploy
name: Run reprepro ${{ matrix.arch }}
strategy:
matrix:
arch: [amd64, arm64]
if: |
always() && !failure() && !cancelled() && ((
github.event_name != 'workflow_dispatch' &&
github.event.release.prerelease != true
) || (
inputs.deploy && inputs.linux
))
uses: ./.github/workflows/reprepro.yaml
secrets: inherit
with:
artifact-name: linux-${{ matrix.arch }}-sqlcipher-system
- name: Find debs
id: deb
if: inputs.linux
run: |
for arch in amd64 arm64
do
echo "$arch=$(ls linux-$arch-sqlcipher-system/*.deb | tail -n1)" >> $GITHUB_OUTPUT
done
- name: Publish amd64 deb to packages.element.io
uses: vector-im/packages.element.io@master
if: inputs.linux
with:
file: ${{ steps.deb.outputs.amd64 }}
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
bucket-api: ${{ vars.CF_R2_S3_API }}
bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
bucket-access-key: ${{ secrets.CF_R2_TOKEN }}
- name: Publish arm64 deb to packages.element.io
uses: vector-im/packages.element.io@master
if: inputs.linux
with:
file: ${{ steps.deb.outputs.arm64 }}
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
bucket-api: ${{ vars.CF_R2_S3_API }}
bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
bucket-access-key: ${{ secrets.CF_R2_TOKEN }}

View file

@ -1,49 +0,0 @@
on:
workflow_call:
inputs:
artifact-name:
type: string
required: true
description: "The name of the artifact containing the deb to include"
secrets:
ELEMENT_BOT_TOKEN:
required: true
CF_R2_ACCESS_KEY_ID:
required: true
CF_R2_TOKEN:
required: true
# Protect reprepro database using concurrency
concurrency: reprepro
jobs:
reprepro:
name: Deploy debian package
environment: packages.element.io
runs-on: ubuntu-latest
env:
R2_INCOMING_BUCKET: ${{ vars.R2_INCOMING_BUCKET }}
R2_URL: ${{ vars.CF_R2_S3_API }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: dist
- name: Upload incoming deb
id: upload
run: |
deb="$(ls *.deb | tail -n1)"
echo "incoming=$deb" >> $GITHUB_OUTPUT
aws s3 cp "$deb" "s3://$R2_INCOMING_BUCKET" --endpoint-url "$R2_URL" --region auto
working-directory: dist
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }}
- name: Notify packages.element.io of incoming deb
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
with:
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
repository: vector-im/packages.element.io
event-type: reprepro-incoming
client-payload: '{"incoming": "${{ steps.upload.outputs.incoming }}"}'