Skip to content

Bump actions/download-artifact from 3 to 4 (#5) #30

Bump actions/download-artifact from 3 to 4 (#5)

Bump actions/download-artifact from 3 to 4 (#5) #30

Workflow file for this run

name: Build
permissions:
contents: write
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
should_release:
description: "Create release?"
required: true
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MAPI
uses: BadMagic100/setup-hk@v2
with:
apiPath: API
dependencyFilePath: ModDependencies.txt
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release
- name: Prepare artifacts for release
uses: actions/upload-artifact@v4
with:
name: MylaFlower
path: MylaFlower/bin/Publish/MylaFlower/zip
- name: Upload metadata
uses: actions/upload-artifact@v4
with:
name: metadata
path: MylaFlower/bin/Publish/MylaFlower/metadata
release:
needs:
- build
runs-on: ubuntu-latest
# only make a release if we manually request the build - other builds will be handled automatically with a push
if: github.event_name == 'workflow_dispatch' && github.event.inputs.should_release == 'true'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Zip
run: |
zip -jr MylaFlower.zip ./artifacts/MylaFlower/*
- name: Generate release info
run: |
echo -n "Sha256: " > ChangeLog.txt ;
sha256sum -b MylaFlower.zip | cut -d " " -f 1 >> ChangeLog.txt ;
- name: Get build version
id: details
run: |
sed '1s/^\xEF\xBB\xBF//' < artifacts/metadata/version.txt > version.txt
echo "buildVersion=$(cat version.txt)" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: false
generate_release_notes: false
fail_on_unmatched_files: true
tag_name: v${{ steps.details.outputs.buildVersion }}
body_path: ChangeLog.txt
files: |
MylaFlower.zip