Skip to content

Commit

Permalink
Use our CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Mar 29, 2024
1 parent 14ead61 commit 4d4a080
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 74 deletions.
112 changes: 64 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,70 @@
name: dotnet package
name: .NET Build and Release

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
push:
branches:
- main
- master
- dev
pull_request:
branches:
- main
- master
- dev

jobs:
build:
env:
dllName: RockTheVote
debugPath: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/bin/Debug

runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '8.0.x' ]

container:
image: mcr.microsoft.com/dotnet/nightly/sdk:8.0

steps:
- uses: actions/checkout@v4

- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build

- name: Create zip
run: cd ${debugPath} && mv net8.0 $dllName && zip -r ${dllName}.zip ${dllName}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload 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 }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{env.debugPath}}/${{env.dllName}}.zip
asset_name: ${{env.dllName}}_${{github.ref_name}}.zip
asset_content_type: application/zip
- uses: actions/checkout@v2

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet publish --configuration Debug

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: net8.0-artifacts
path: |
bin/Debug/net8.0/publish/RockTheVote*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: net8.0-artifacts
path: bin/Debug/net8.0

- name: Create Tag
id: tag_version
run: |
DATE=$(date +'%y.%m.%d-%H%M%S')
echo "RELEASE_TAG=$DATE" >> $GITHUB_ENV
- name: Determine if Pre-release
id: prerelease
run: |
if [ "${{ github.ref }}" != "refs/heads/main" ]; then
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
fi
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_TAG }}
files: bin/Debug/net8.0/*
prerelease: ${{ env.IS_PRERELEASE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion RockTheVote.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
25 changes: 0 additions & 25 deletions RockTheVote.sln

This file was deleted.

0 comments on commit 4d4a080

Please sign in to comment.