Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
RayMMond committed Jul 1, 2022
1 parent a0d4755 commit e17199a
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: publish to easyabp.io
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0

- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: \]\((/docs/)
replace: "](/modules/${{ github.event.repository.name }}/"
include: docs/**.md

- name: Pull repo and change files
id: change
run: |
ls
git clone https://github.com/EasyAbp/easyabp.github.io
cd easyabp.github.io
rm -rf docs/modules/${{ github.event.repository.name }}
rm -rf docs/.vuepress/public/modules/${{ github.event.repository.name }}
cp -rf ../docs/ docs/modules/${{ github.event.repository.name }}
cp -rf ../docs/ docs/.vuepress/public/modules/${{ github.event.repository.name }}
git add --all
echo "##[set-output name=diff;]$(git diff --staged)"
- name: Commit files
if: steps.change.outputs.diff
run: |
ls
cd easyabp.github.io
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update the docs of ${{ github.event.repository.name }}" -a
- name: Push changes
if: steps.change.outputs.diff
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.EASYABP_IO_ACCESS_TOKEN }}
repository: EasyAbp/easyabp.github.io
directory: easyabp.github.io
81 changes: 81 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: publish to nuget
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: NuGet/[email protected]
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'

- name: read common.props
id: commonProps
uses: juliangruber/read-file-action@v1
with:
path: ./common.props

- name: get version
id: getVersion
uses: AsasInnab/regex-action@v1
with:
regex_pattern: '(?<=>)[^<>]+(?=</Version>)'
regex_flags: 'gim'
search_string: '${{ steps.commonProps.outputs.content }}'

- name: dotnet restore
run: dotnet restore -s "https://api.nuget.org/v3/index.json"

- name: dotnet build
run: dotnet build -c Release

- name: dotnet pack
run: dotnet pack -c Release --no-build -o dest

- name: remove unused packages
run: |
cd dest
del * -Exclude EasyAbp.*
del * -Exclude *.${{ steps.getVersion.outputs.first_match }}.nupkg
del *.Blazor.Host.*
del *.Blazor.Server.Host.*
del *.Host.Shared.*
del *.HttpApi.Host.*
del *.IdentityServer.*
del *.Web.Host.*
del *.Web.Unified.*
del *.HttpApi.Client.ConsoleTestApp.*
del *.Tests.*
del *.TestBase.*
dir -name
- name: dotnet nuget push to GitHub
uses: tanaka-takayoshi/[email protected]
with:
nupkg-path: 'dest\*.nupkg'
repo-owner: 'EasyAbp'
gh-user: 'EasyAbp'
token: ${{ secrets.GITHUB_TOKEN }}

- name: dotnet nuget push to NuGet
run: dotnet nuget push dest\*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate

- name: determine if the tag exists
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ steps.getVersion.outputs.first_match }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: add git tag
if: ${{ steps.checkTag.outputs.exists == 'false' }}
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.getVersion.outputs.first_match }}

0 comments on commit e17199a

Please sign in to comment.