Skip to content

Commit

Permalink
Adding S3 repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kallioli committed May 6, 2024
1 parent 8278369 commit b102014
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions .github/workflows/create-image.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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

0 comments on commit b102014

Please sign in to comment.