fix: Links inside PDFs redirecting instead of opening on the browser #146
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build pull request artifacts | |
on: | |
pull_request: | |
branches: | |
- master | |
- develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: contains(github.event.pull_request.labels.*.name, 'build-artifacts') | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Disable git core.autocrlf | |
run: git config --global core.autocrlf false | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node 20.14.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.14.0' | |
- name: Setup node_modules cache | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install package dependencies | |
run: yarn install | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn test | |
- name: Build app/ | |
run: yarn build | |
env: | |
NODE_ENV: production | |
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }} | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
- name: Build Windows Package | |
if: ${{ matrix.os == 'windows-latest'}} | |
run: yarn electron-builder --publish never --x64 --win nsis | |
env: | |
CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | |
- name: Build MacOS Package | |
if: ${{ matrix.os == 'macos-latest'}} | |
run: | | |
sudo mdutil -a -i off | |
yarn electron-builder --publish never --mac --universal | |
env: | |
CSC_LINK: ${{ secrets.MAC_CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }} | |
CSC_FOR_PULL_REQUEST: true | |
FORCE_NOTARIZE: true | |
APPLEID: ${{ secrets.APPLEID }} | |
APPLEIDPASS: ${{ secrets.APPLEIDPASS }} | |
ASC_PROVIDER: 'S6UPZG7ZR3' | |
- name: Build Ubuntu Package | |
if: ${{ matrix.os == 'ubuntu-latest'}} | |
run: yarn electron-builder --publish never --linux snap | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }} Artifacts | |
path: | | |
dist/rocketchat-*.dmg | |
dist/rocketchat-*.pkg | |
dist/rocketchat-*.exe | |
dist/rocketchat-*.snap | |
- name: Get Artifact URL | |
id: get-artifact-url | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const runId = context.runId; | |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner, | |
repo, | |
run_id: runId | |
}); | |
const artifact = artifacts.data.artifacts.find(a => a.name === '${{ runner.os }} Artifacts'); | |
if (artifact) { | |
const url = `https://github.com/${owner}/${repo}/actions/runs/${runId}/artifacts/${artifact.id}`; | |
core.setOutput('artifact_url', url); | |
} else { | |
core.setFailed(`Artifact not found for ${artifact.name}`); | |
} | |
- name: Post PR Comment with the Artifact link | |
if: steps.get-artifact-url.outputs.artifact_url != '' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
### [${{ runner.os }} installer download](${{ steps.get-artifact-url.outputs.artifact_url }}) | |
header: '### Artifact for ${{ runner.os }}' | |
recreate: true | |
append: false |