-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from GitHub-Kieran/gh-release-workflow
Gh release workflow
- Loading branch information
Showing
4 changed files
with
111 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: [ '**', '!main' ] | ||
pull_request: | ||
branches: [ '**' ] | ||
|
||
jobs: | ||
build-and-unit-test: | ||
uses: ./.github/workflows/reusable-build-and-unit-test.yml | ||
cleanup-workflow-run-logs: | ||
uses: ./.github/workflows/reusable-github-workflow-run-cleanup.yml | ||
needs: build-and-unit-test | ||
permissions: | ||
actions: write | ||
with: | ||
days_old: "0" | ||
runs_to_keep: "2" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Create github release | ||
|
||
on: | ||
push: | ||
branches: [ 'main' ] | ||
|
||
jobs: | ||
|
||
build-and-unit-test: | ||
uses: ./.github/workflows/reusable-build-and-unit-test.yml | ||
|
||
publish: | ||
runs-on: ${{ matrix.operating-system }} | ||
needs: build-and-unit-test | ||
permissions: | ||
contents: write | ||
|
||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Download solution artifact | ||
uses: actions/download-artifact@main | ||
with: | ||
name: Solution artifact | ||
- name: Publish | ||
run: dotnet publish --configuration Release -p:UseAppHost=false --no-build --verbosity normal --output ./dist ./src/FileSorter.Console/FileSorter.Console.csproj | ||
|
||
- name: Archive Release | ||
uses: thedoctor0/zip-release@0.7.5 | ||
with: | ||
type: 'zip' | ||
filename: file-sorter-v0.${{ github.run_number }}.0-beta.zip | ||
exclusions: '*.git* /*node_modules/* .editorconfig' | ||
path: dist | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: file-sorter-v0.${{ github.run_number }}.0-beta.zip | ||
tag_name: v0.${{ github.run_number }}.0-beta | ||
prerelease: true | ||
draft: true | ||
generate_release_notes: true | ||
|
||
cleanup-workflow-run-logs: | ||
uses: ./.github/workflows/reusable-github-workflow-run-cleanup.yml | ||
needs: publish | ||
permissions: | ||
actions: write | ||
with: | ||
days_old: "0" | ||
runs_to_keep: "2" |
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
27 changes: 27 additions & 0 deletions
27
.github/workflows/reusable-github-workflow-run-cleanup.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Clean up workflow runs | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
days_old: | ||
description: "The amount of days old to delete" | ||
type: string | ||
default: "0" | ||
required: false | ||
runs_to_keep: | ||
description: "The amount of latest workflows runs to keep" | ||
type: string | ||
default: "2" | ||
required: false | ||
|
||
jobs: | ||
clean-logs: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
- uses: igorjs/gh-actions-clean-workflow@v4 | ||
with: | ||
days_old: "0" | ||
runs_to_keep: "2" | ||
|