change image creattion process #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | ||
name: CI | ||
# 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 | ||
runs-on: [self-hosted, freebsd] | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- 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: | | ||
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: 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 | ||