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 c5dc1eb commit b5f536f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: brdgm/github-action-build@main
- 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 }}
75 changes: 11 additions & 64 deletions .github/workflows/gitflow-release.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,24 @@
name: GitFlow Release
name: Release and Deploy

on:
workflow_dispatch:

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

permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

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

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

- name: set git config
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
- name: Install git flow extensions
run: |
sudo apt-get install git-flow
- run: git flow init --defaults
- run: git flow release start ${{ steps.package_json.outputs.version }}
- run: git flow release finish ${{ steps.package_json.outputs.version }} --push --message "Release"

- 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 }}

- name: set next version
run: |
npm --no-git-tag-version version patch
git config user.name "GitHub Actions"
git config user.email noreply@github.com
git add package.json package-lock.json
git commit --message "set next version"
git push
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.package_json.outputs.version }}
generateReleaseNotes: true
- 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 b5f536f

Please sign in to comment.