|
8 | 8 | paths:
|
9 | 9 | - Directory.Packages.props
|
10 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
11 | 14 | jobs:
|
12 |
| - release-build: |
| 15 | + push-release-build: |
| 16 | + if: github.event_name == 'push' |
13 | 17 | runs-on: ubuntu-latest
|
14 | 18 | steps:
|
15 | 19 | - name: Checkout
|
16 | 20 | uses: actions/checkout@v4
|
17 | 21 |
|
18 |
| - - name: Set up Node.js |
19 |
| - uses: actions/setup-node@v4 |
20 |
| - with: |
21 |
| - node-version: '20' |
22 |
| - |
23 |
| - - name: Install frontend dependencies |
24 |
| - working-directory: web-site |
25 |
| - run: npm i |
26 |
| - |
27 |
| - - name: Build frontend (outputs to backend wwwroot) |
28 |
| - working-directory: web-site |
29 |
| - run: npm run build |
30 |
| - |
31 |
| - - name: Set up Docker Buildx |
32 |
| - uses: docker/setup-buildx-action@v3 |
33 |
| - |
34 |
| - - name: Login to Docker Registry |
35 |
| - uses: docker/login-action@v3 |
36 |
| - with: |
37 |
| - registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com |
38 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
39 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
40 |
| - |
41 | 22 | - name: Extract version from Directory.Packages.props
|
42 | 23 | id: get_version
|
43 | 24 | shell: pwsh
|
|
53 | 34 | $props[$n.Name] = [string]$n.InnerText
|
54 | 35 | }
|
55 | 36 | }
|
56 |
| - # Provide concrete TimeStamp (UTC yyyyMMdd) in case used in Version |
57 | 37 | $props['TimeStamp'] = (Get-Date -AsUTC).ToString('yyyyMMdd')
|
58 | 38 | $unresolved = New-Object System.Collections.Generic.List[string]
|
59 | 39 | $finalVersion = [regex]::Replace($versionTemplate, '\$\(([A-Za-z0-9_.-]+)\)', {
|
|
67 | 47 | Write-Host "Version template: $versionTemplate"
|
68 | 48 | Write-Host "Final version: $finalVersion"
|
69 | 49 |
|
70 |
| - - name: Build and push koala-wiki |
| 50 | + - name: Create GitHub Release v${{ steps.get_version.outputs.version }} |
| 51 | + uses: softprops/action-gh-release@v2 |
| 52 | + with: |
| 53 | + tag_name: v${{ steps.get_version.outputs.version }} |
| 54 | + name: v${{ steps.get_version.outputs.version }} |
| 55 | + generate_release_notes: true |
| 56 | + draft: false |
| 57 | + prerelease: false |
| 58 | + make_latest: true |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
| 62 | + - name: Set up Node.js |
| 63 | + uses: actions/setup-node@v4 |
| 64 | + with: |
| 65 | + node-version: '20' |
| 66 | + |
| 67 | + - name: Install frontend dependencies |
| 68 | + working-directory: web-site |
| 69 | + run: npm i |
| 70 | + |
| 71 | + - name: Build frontend (outputs to backend wwwroot) |
| 72 | + working-directory: web-site |
| 73 | + run: npm run build |
| 74 | + |
| 75 | + - name: Set up Docker Buildx |
| 76 | + uses: docker/setup-buildx-action@v3 |
| 77 | + |
| 78 | + - name: Login to Docker Registry |
| 79 | + uses: docker/login-action@v3 |
| 80 | + with: |
| 81 | + registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com |
| 82 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 83 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 84 | + |
| 85 | + - name: Build and push koala-wiki (v${{ steps.get_version.outputs.version }}) |
71 | 86 | uses: docker/build-push-action@v5
|
72 | 87 | with:
|
73 | 88 | context: .
|
|
78 | 93 | crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:latest
|
79 | 94 | crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:${{ steps.get_version.outputs.version }}
|
80 | 95 |
|
| 96 | + release-build: |
| 97 | + if: github.event_name == 'release' && github.actor != 'github-actions[bot]' |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - name: Checkout tag |
| 101 | + uses: actions/checkout@v4 |
| 102 | + with: |
| 103 | + ref: ${{ github.event.release.tag_name }} |
| 104 | + |
| 105 | + - name: Set up Node.js |
| 106 | + uses: actions/setup-node@v4 |
| 107 | + with: |
| 108 | + node-version: '20' |
| 109 | + |
| 110 | + - name: Install frontend dependencies |
| 111 | + working-directory: web-site |
| 112 | + run: npm i |
| 113 | + |
| 114 | + - name: Build frontend (outputs to backend wwwroot) |
| 115 | + working-directory: web-site |
| 116 | + run: npm run build |
| 117 | + |
| 118 | + - name: Set up Docker Buildx |
| 119 | + uses: docker/setup-buildx-action@v3 |
| 120 | + |
| 121 | + - name: Login to Docker Registry |
| 122 | + uses: docker/login-action@v3 |
| 123 | + with: |
| 124 | + registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com |
| 125 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 126 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 127 | + |
| 128 | + - name: Extract version from release tag |
| 129 | + id: get_version |
| 130 | + shell: pwsh |
| 131 | + run: | |
| 132 | + $tag = '${{ github.event.release.tag_name }}' |
| 133 | + if ([string]::IsNullOrWhiteSpace($tag)) { throw 'Release tag name is empty' } |
| 134 | + $ver = if ($tag.StartsWith('v')) { $tag.Substring(1) } else { $tag } |
| 135 | + "version=$ver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 |
| 136 | + Write-Host "Release tag: $tag" |
| 137 | + Write-Host "Version: $ver" |
| 138 | +
|
| 139 | + - name: Build and push koala-wiki |
| 140 | + uses: docker/build-push-action@v5 |
| 141 | + with: |
| 142 | + context: . |
| 143 | + file: src/KoalaWiki/Dockerfile |
| 144 | + platforms: linux/amd64 |
| 145 | + push: true |
| 146 | + tags: | |
| 147 | + crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:latest |
| 148 | + crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/koala-ai/koala-wiki:${{ steps.get_version.outputs.version }} |
0 commit comments