WIP: Build & Release
This commit is contained in:
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@@ -6,20 +6,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install Angular CLI
|
||||
run: yarn global add @angular/cli
|
||||
|
||||
- name: Configure ng to use yarn
|
||||
run: ng config --global cli.packageManager yarn
|
||||
|
||||
- name: Yarn install
|
||||
working-directory: Frontend
|
||||
run: yarn install
|
||||
|
||||
- name: Build Angular
|
||||
working-directory: Frontend
|
||||
run: ng build --configuration=production
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -30,23 +36,28 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup dotnet 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: WebAPI
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
working-directory: WebAPI
|
||||
run: |
|
||||
dotnet build --configuration Release --no-restore
|
||||
dotnet publish --configuration Release --framework net9.0 --runtime linux-x64 --self-contained false --output ./WebApiBuild
|
||||
dotnet publish --configuration Release --framework net9.0 --runtime linux-x64 --self-contained false --output ./WebApiBuild
|
||||
|
||||
- name: Clean up
|
||||
working-directory: WebAPI
|
||||
run: |
|
||||
rm ./WebApiBuild/appsettings.Development.json
|
||||
rm ./WebApiBuild/client_secrets.Development.json
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
@@ -17,14 +17,11 @@ module.exports = async ({ github, context, core, jobId }) => {
|
||||
let match;
|
||||
while (match = regex.exec(data)) {
|
||||
const token = match[1].replace(/-/g, '_').toUpperCase();
|
||||
console.log(token);
|
||||
const value = getValue(token, jobId);
|
||||
console.log(value);
|
||||
if (!value) {
|
||||
core.setFailed(`Token ${token} not found`);
|
||||
return false;
|
||||
}
|
||||
// replace all occurrences of the ${token} with the value in file
|
||||
const result = data.replace(new RegExp(`#{${token}}`, 'g'), value);
|
||||
require('fs').writeFileSync(file, result, 'utf8');
|
||||
}
|
||||
|
||||
21
.github/workflows/release-morska.yml
vendored
21
.github/workflows/release-morska.yml
vendored
@@ -17,9 +17,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Assign run ID if provided
|
||||
if: ${{ github.event.inputs.job_id != '' }}
|
||||
run: echo "job_id=${{ github.event.inputs.job_id }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Get last build ID
|
||||
id: get-build-id
|
||||
if: ${{ github.event.inputs.job_id == '' }}
|
||||
@@ -29,6 +31,7 @@ jobs:
|
||||
const script = require('./.github/workflows/buildScripts/getLastBuildId.js');
|
||||
const jobId = await script({github, context});
|
||||
core.setOutput("job_id", jobId);
|
||||
|
||||
- name: Set job_id
|
||||
if: ${{ github.event.inputs.job_id == '' }}
|
||||
run: echo "job_id=${{ steps.get-build-id.outputs.job_id }}" >> $GITHUB_ENV
|
||||
@@ -38,20 +41,21 @@ jobs:
|
||||
echo "Error: job_id is empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download frontend artifacts
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/workflows/buildScripts/downloadArtifacts.js');
|
||||
await script({github, context, core, jobId: ${{env.job_id}}, name: 'frontend'});
|
||||
|
||||
- name: Download backend artifacts
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/workflows/buildScripts/downloadArtifacts.js');
|
||||
await script({github, context, core, jobId: ${{env.job_id}}, name: 'webapi'});
|
||||
- name: List artifacts
|
||||
run: ls -laR ./${{env.job_id}}
|
||||
|
||||
- name: Tokenize
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
@@ -61,3 +65,16 @@ jobs:
|
||||
script: |
|
||||
const script = require('./.github/workflows/buildScripts/replaceTokens.js');
|
||||
await script({github, context, core, jobId: ${{env.job_id}} });
|
||||
|
||||
- name: Archive frontend artifacts
|
||||
run: |
|
||||
cd ${{env.job_id}}/frontend
|
||||
zip -r ../morska-frontend.zip .
|
||||
|
||||
- name: Archive backend artifacts
|
||||
run: |
|
||||
cd ${{env.job_id}}/webapi
|
||||
zip -r ../morska-webapi.zip .
|
||||
|
||||
- name: List artifacts
|
||||
run: ls -la .
|
||||
|
||||
Reference in New Issue
Block a user