Skip to content

Commit

Permalink
reuse github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed May 3, 2024
1 parent 5853ad1 commit 090bbc4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 79 deletions.
32 changes: 4 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Read properties from package.json
id: package_json
uses: zoexx/github-action-json-file-properties@1.0.6
with:
file_path: package.json

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci
- run: npm run lint
- run: npm run test:coverage
- run: npm run build
- uses: SonarSource/sonarcloud-github-action@master
if: env.SONARCLOUD_TOKEN != null
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ env.SONARCLOUD_TOKEN }}
with:
args: -Dsonar.projectVersion=${{steps.package_json.outputs.version}}
- uses: brdgm/github-action-build@v1
with:
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
42 changes: 9 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,17 @@ on:
workflow_dispatch:

jobs:
build:
deploy:
runs-on: ubuntu-latest
environment:
name: Production
url: "https://brdgm.me/${{ steps.package_json.outputs.appDeployName }}"
url: "https://brdgm.me/${{ steps.deploy.outputs.app-deploy-name }}"

steps:
- uses: actions/checkout@v4

- name: Read properties from package.json
id: package_json
uses: zoexx/github-action-json-file-properties@1.0.6
with:
file_path: package.json

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci
- run: npm run test:unit
- run: npm run build

- name: Copy to Site
uses: cpina/github-action-push-to-another-repository@v1.7.2
env:
API_TOKEN_GITHUB: ${{ secrets.GH_SITE_DEPLOY_PAT }}
with:
source-directory: dist
destination-repository-username: brdgm
destination-repository-name: brdgm.github.io
destination-github-username: ${{ secrets.GH_SITE_DEPLOY_USERNAME }}
user-email: ${{ secrets.GH_SITE_DEPLOY_EMAIL }}
user-name: ${{ secrets.GH_SITE_DEPLOY_NAME }}
target-branch: main
commit-message: deploy ${{ steps.package_json.outputs.appDeployName }} ${{ steps.package_json.outputs.version }}
target-directory: ${{ steps.package_json.outputs.appDeployName }}
- uses: brdgm/github-action-deploy@v1
id: deploy
with:
gh-site-deploy-pat: ${{ secrets.GH_SITE_DEPLOY_PAT }}
gh-site-deploy-username: ${{ secrets.GH_SITE_DEPLOY_USERNAME }}
gh-site-deploy-email: ${{ secrets.GH_SITE_DEPLOY_EMAIL }}
gh-site-deploy-name: ${{ secrets.GH_SITE_DEPLOY_NAME }}
18 changes: 0 additions & 18 deletions .github/workflows/release-from-tag.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release and Deploy

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
environment:
name: Production
url: "https://brdgm.me/${{ steps.release.outputs.app-deploy-name }}"

permissions:
contents: write

steps:
- uses: brdgm/github-action-release@v1
id: release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-site-deploy-pat: ${{ secrets.GH_SITE_DEPLOY_PAT }}
gh-site-deploy-username: ${{ secrets.GH_SITE_DEPLOY_USERNAME }}
gh-site-deploy-email: ${{ secrets.GH_SITE_DEPLOY_EMAIL }}
gh-site-deploy-name: ${{ secrets.GH_SITE_DEPLOY_NAME }}

0 comments on commit 090bbc4

Please sign in to comment.