64 lines
2.2 KiB
YAML
64 lines
2.2 KiB
YAML
name: Morska Release
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
job_id:
|
|
description: 'Job ID of the build to release'
|
|
required: false
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
environment: Morska
|
|
|
|
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 == '' }}
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
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
|
|
- name: Check job_id
|
|
run: |
|
|
if [ -z "${{ env.job_id }}" ]; then
|
|
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:
|
|
SECRETS: ${{ toJson(secrets) }}
|
|
VARIABLES: ${{ toJson(vars) }}
|
|
with:
|
|
script: |
|
|
const script = require('./.github/workflows/buildScripts/replaceTokens.js');
|
|
await script({github, context, core, jobId: ${{env.job_id}} });
|