From 6c8fe306e0ef38ea36d1dc6be484a3eb8131f124 Mon Sep 17 00:00:00 2001 From: amercader Date: Mon, 9 Dec 2024 10:56:16 +0100 Subject: [PATCH] Restore --- .github/workflows/build.yml | 7 ++-- .github/workflows/publish.yml | 62 +++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9eb2b8..1b75842 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,5 @@ on: - v* jobs: - test: - - runs-on: ubuntu-latest - steps: - - run: echo "hola" + call-build-workflow: + uses: ./.github/workflows/reusable-build-package.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b4e96b5..a2ff231 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,8 +6,66 @@ on: - v* jobs: - test: + call-build-workflow: + uses: ./.github/workflows/reusable-build-package.yml + upload-to-s3: + needs: call-build-workflow runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} steps: - - run: echo "adeu" + - uses: actions/download-artifact@v4 + with: + pattern: python-ckan* + merge-multiple: true + - name: Generate hash and upload + run: | + # Download current md5sum file + aws s3 cp s3://${{ secrets.AWS_BUCKET }}/md5sum . + + for file in python-ckan*; do + # Remove current md5sum entry + sed -i "/$file/d" md5sum + + # Add updated entry to md5sum file + md5sum $file >> md5sum + + # Upload deb file + aws s3 cp $file s3://${{ secrets.AWS_BUCKET }}/staging/$file + done + + # Upload updated md5sum file + aws s3 cp md5sum s3://${{ secrets.AWS_BUCKET }}/staging/md5sum + + upload-to-release: + needs: call-build-workflow + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + pattern: python-ckan* + merge-multiple: true + - name: Create release and upload the deb files + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSIONS=$(cat "VERSIONS.json") + + LIST=$(echo $VERSIONS | jq -r ' + (.[] | ["* \(.ckan_ref) on Ubuntu \(.ubuntu_version)"]) | + .[] + ') + + NOTES="This release includes deb packages for the following versions. + Please check the relevant file in the Assets section below. + + $LIST + + Packages are also available at https://packaging.ckan.org." + + gh release create ${{ github.ref_name }} ./python-ckan* --verify-tag --notes "$NOTES"