Skip to content

Adding S3 repository #22

Adding S3 repository

Adding S3 repository #22

Workflow file for this run

# 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:
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: [ self-hosted, freebsd ]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Get tag name
run: echo "REF_NAME=$(echo ${GITHUB_REF##*/} | tr / -)" >> $GITHUB_ENV
- name: Debug
run: echo ${{ env.REF_NAME }}
# Run building script
- name: Run build.sh
run: |
export PATH=/usr/local/bin/:$PATH
sudo chmod +x build.sh
sudo ./build.sh ${{ env.REF_NAME }}
# Converting image
- name: Converting image to QCOW2 format
run: |
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: 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 }}/${{ 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