mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-05 14:35:43 +00:00
Building with Github Actions
This commit is contained in:
parent
b626c6c644
commit
e67a688baa
7 changed files with 122 additions and 9 deletions
2
.github/workflows/autolock.yml
vendored
2
.github/workflows/autolock.yml
vendored
|
|
@ -2,7 +2,7 @@ name: 'Auto-Lock Issues'
|
|||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '17 2 * * *'
|
||||
- cron: '17 2 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
|
|
|||
53
.github/workflows/dev.yml
vendored
Normal file
53
.github/workflows/dev.yml
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
name: Dev build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths-ignore: [ '.**', 'Examples/**', '**.md' ]
|
||||
|
||||
env:
|
||||
PROJECT_PATH: src/WTelegramClient.csproj
|
||||
CONFIGURATION: Release
|
||||
RELEASE_NOTES: ${{ github.event.head_commit.message }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Determine version
|
||||
run: |
|
||||
git fetch --depth=100 --tags
|
||||
DESCR_TAG=$(git describe --tags)
|
||||
COMMITS=${DESCR_TAG#*-}
|
||||
COMMITS=${COMMITS%-*}
|
||||
LAST_TAG=${DESCR_TAG%%-*}
|
||||
NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1))-dev.$COMMITS
|
||||
RELEASE_VERSION=${{vars.RELEASE_VERSION}}-dev.$COMMITS
|
||||
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
||||
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Pack
|
||||
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
|
||||
# - name: Upload artifact
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: packages
|
||||
# path: packages/*.nupkg
|
||||
- name: Nuget push
|
||||
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
||||
- name: Deployment Notification
|
||||
env:
|
||||
JSON: |
|
||||
{
|
||||
"status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }},
|
||||
"message": "{ \"commitId\": \"${{ github.event.head_commit.id }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"teamProjectName\": \"${{ github.event.repository.name }}\"}"
|
||||
}
|
||||
run: |
|
||||
curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }}
|
||||
56
.github/workflows/release.yml
vendored
Normal file
56
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
name: Release build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_notes:
|
||||
description: 'Release notes'
|
||||
required: true
|
||||
version:
|
||||
description: "Release version (leave empty for automatic versioning)"
|
||||
|
||||
run-name: '📌 Release build ${{ inputs.version }}'
|
||||
|
||||
env:
|
||||
PROJECT_PATH: src/WTelegramClient.csproj
|
||||
CONFIGURATION: Release
|
||||
RELEASE_NOTES: ${{ inputs.release_notes }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # For git tag
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Determine version
|
||||
if: ${{ env.VERSION == '' }}
|
||||
run: |
|
||||
git fetch --depth=100 --tags
|
||||
DESCR_TAG=$(git describe --tags)
|
||||
LAST_TAG=${DESCR_TAG%%-*}
|
||||
NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1))
|
||||
RELEASE_VERSION=${{vars.RELEASE_VERSION}}
|
||||
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
|
||||
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Pack
|
||||
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
|
||||
# - name: Upload artifact
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: packages
|
||||
# path: packages/*.nupkg
|
||||
- name: Nuget push
|
||||
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
|
||||
- name: Git tag
|
||||
run: |
|
||||
git tag $VERSION
|
||||
git push --tags
|
||||
Loading…
Add table
Add a link
Reference in a new issue