From b10201412218aace97fac55178fb4547adc3ab96 Mon Sep 17 00:00:00 2001 From: Kevin Allioli Date: Mon, 6 May 2024 13:39:33 +0200 Subject: [PATCH] Adding S3 repository --- .github/workflows/create-image.yml | 50 ++++++++++++------------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/.github/workflows/create-image.yml b/.github/workflows/create-image.yml index 3c6ee11..9efc656 100644 --- a/.github/workflows/create-image.yml +++ b/.github/workflows/create-image.yml @@ -1,6 +1,13 @@ # This is a basic workflow to help you get started with Actions name: CI +env: + S3_ENDPOINT: ${{ vars.S3_ENDPOINT }} + ACCESS_KEY: ${{ secrets.ACCESS_KEY }} + SECRET_KEY: ${{ secrets.SECRET_KEY }} + S3_ALIAS: ${{ secrets.S3_ALIAS }} + S3_BUCKET: ${{ vars.S3_BUCKET }} + # Controls when the workflow will run on: push: @@ -40,35 +47,16 @@ jobs: sudo qemu-img convert -f raw -O qcow2 -c -S 4k final.raw freebsd-${{ env.REF_NAME }}-amd64.qcow2 sudo md5sum freebsd-${{ env.REF_NAME }}-amd64.qcow2 > md5.txt - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.REF_NAME }} - release_name: FreeBSD version ${{ env.REF_NAME }} - draft: false - prerelease: false - - - name: Upload image to release asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: freebsd-${{ env.REF_NAME }}-amd64.qcow2 - asset_name: freebsd-${{ env.REF_NAME }}-amd64.qcow2 - asset_content_type: application/octet-stream - - - name: Add md5.txt file - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: md5.txt - asset_name: md5.txt - asset_content_type: text/plain + - name: Uploading image in object storage + run: | + echo "Uploading image in object storage" + minio-client alias set ${{ env.S3_ALIAS }} ${{ env.S3_ENDPOINT }} ${{ env.ACCESS_KEY }} ${{ env.SECRET_KEY }} + minio-client cp freebsd-${{ env.REF_NAME }}-amd64.qcow2 ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/freebsd-${{ env.REF_NAME }}-amd64.qcow2 + minio-client cp md5.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/md5.txt + minio-client cp sha1.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/sha1.txt + minio-client cp sha256.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/sha256.txt + minio-client cp ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/freebsd-${{ env.REF_NAME }}-amd64.qcow2 ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/i${{ env.REF_NAME }}/freebsd-${{ env.REF_NAME }}-amd64.qcow2 + minio-client cp ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/md5.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/${{ env.VERSION }}/md5.txt + minio-client cp ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/sha1.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/${{ env.VERSION }}/sha1.txt + minio-client cp ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/latest/sha256.txt ${{ env.S3_ALIAS }}/${{ env.S3_BUCKET }}/${{ env.VERSION }}/sha256.txt