Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub Actions #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:
paths:
- ".github/workflows/build-commit.yml"
- "src/**"
- "tests/**"
- "Bundles.sln"
- "Directory.Build.props"
- "Directory.Packages.props"
workflow_dispatch:

env:
DOTNET_NOLOGO: 1
Expand All @@ -14,7 +18,7 @@ env:
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1

jobs:
build_commit:
build-commit:
name: Build Commit ${{ github.sha }}
runs-on: self-hosted
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')"
Expand All @@ -26,4 +30,6 @@ jobs:
with:
dotnet-version: 8
- name: Build Project
run: dotnet build
run: dotnet build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(potentially for future reference)
ideally we want to pass the run number and hash here so that we can build assembly metadata from them if/when we add dev builds. not a priority right now though

- name: Run Tests
run: dotnet test
16 changes: 13 additions & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ name: Build PR

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
paths:
- ".github/workflows/build-pr.yml"
- "src/**"
- "tests/**"
- "Bundles.sln"
- "Directory.Build.props"
- "Directory.Packages.props"

env:
DOTNET_NOLOGO: 1
Expand All @@ -14,8 +22,8 @@ env:
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1

jobs:
build_pr:
name: Build PR \#${{ github.event.pull_request.number }}
build-pr:
name: "Build PR #${{ github.event.pull_request.number }}"
runs-on: self-hosted
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')"
steps:
Expand All @@ -26,4 +34,6 @@ jobs:
with:
dotnet-version: 8
- name: Build Project
run: dotnet build
run: dotnet build
- name: Run Tests
run: dotnet test
7 changes: 4 additions & 3 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: Regenerate Resource Files
name: Regenerate Image Files

on:
push:
paths:
- ".github/workflows/images.yml"
- "img/**"
- "tools/generate-assets.sh"
- "tools/generate-images.sh"
workflow_dispatch:

jobs:
regenerate-assets:
name: Regenerate Image Files
permissions: write-all
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Assets
run: tools/generate-assets.sh
run: tools/generate-images.sh
33 changes: 3 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ on:
release:
types:
- "published"
push:
paths:
- ".github/workflows/publish.yml"
- "src/Bundles/Bundles.csproj"
- "tests/Bundles.Tests/Bundles.Tests.csproj"
- "Directory.Build.props"
- "Directory.Packages.props"

env:
DOTNET_NOLOGO: 1
Expand All @@ -22,7 +15,7 @@ jobs:
publish_release:
name: Publish Release
runs-on: "self-hosted"
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]') && contains(github.event.release.target_commitish, 'master') && github.event_name == 'release'"
if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -33,7 +26,7 @@ jobs:
- name: Publish NuGet packages
run: |
mkdir build
dotnet pack -c Release -o build
dotnet pack -c Release -o build /p:Version=${{ github.event.release.tag_name }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work for two reasons.

  1. -o is unsupported on solution level, that's what we use artifacts output for. no more build folders.
  2. github.event.release.tag_name will usually contain a preceding v; and we might want to version different packages differently. imo the best way to handle this is to just not touch it at all and leave it up to the csproj files

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. -o is very much supported on a solution level
  2. ok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. mb, i forgot that sdk 7.0.201 reenabled it; but we should still use artifacts output for the reasons listed on discord

dotnet nuget push "build/*" -k ${{ secrets.NUGET_ORG_API_KEY }} -s https://api.nuget.org/v3/index.json
- name: Upload NuGet packages to GitHub Actions
uses: actions/upload-artifact@v3
Expand All @@ -48,24 +41,4 @@ jobs:
artifacts: "build/*"
token: ${{ secrets.GITHUB_TOKEN }}
omitNameDuringUpdate: true # We don't want to update the name of the release.
omitBodyDuringUpdate: true # We don't want to update the body of the release.
test_release:
name: Test Release
runs-on: "self-hosted"
if: "!contains(github.event.head_commit.message, '[ci-skip]') && github.ref_name == 'master' && github.event_name == 'push'"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8
- name: Publish NuGet packages
run: |
mkdir build
dotnet pack -c Release -o build
- name: Upload NuGet packages to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: Bundles Release ${{ github.event.release.name }} NuGet Packages.zip
path: build/*
omitBodyDuringUpdate: true # We don't want to update the body of the release.
Binary file modified img/logo.ico
Binary file not shown.
Binary file modified img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 3 additions & 11 deletions tools/generate-assets.sh → tools/generate-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@ regenerate()
svgo --multipass --quiet "$1"

# Convert to PNG
convert -size 1024x1024 -background transparent "$1" "${1%.*}.png"
convert -background none "$1" "${1%.*}.png"

# Convert to ICO
# https://stackoverflow.com/a/15104985
convert -background transparent -colors 256 "$1" \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
\( -clone 0 -resize 128x128 \) \
\( -clone 0 -resize 256x256 \) \
-delete 0 "${1%.*}.ico"
convert -background transparent -define "icon:auto-resize=16,24,32,64,128,256" "$1" "${1%.*}.ico"
}

# Iterate over each file matching the pattern "*.svg" in the "res" directory
# Iterate over each file matching the pattern "*.svg" in the "img" directory
for file in img/*.svg; do
# Execute the "regenerate" command on each file
regenerate "$file"
Expand Down