Skip to content

Commit

Permalink
Merge pull request #768 from danskernesdigitalebibliotek/develop
Browse files Browse the repository at this point in the history
Get latest changes from develop
  • Loading branch information
spaceo authored Dec 11, 2023
2 parents 8cd7cd8 + e2d85ba commit 4d25f89
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 201 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/create-release-on-branch-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Create release on branch changes

on:
push:
branches-ignore:
# Dependabot does not have permissions to create releases
- 'dependabot/**'

jobs:
create_release_on_branch_changes:
name: "Create release on branch changes"
runs-on: ubuntu-latest
steps:
- name: Set release variables
id: resolve-release-vars
# Version 0.0.0-SHA is a schema that supports semantic versioning but
# should sink below proper versions.
# Output package.json to provide insight and help debugging
# Using branch names as tags allows other projects to track unreleased
# development.
run: |
RELEASE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})
RELEASE_SHA=${{ github.sha }}
TAG_NAME=$(echo "branch-${RELEASE_BRANCH}")
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> "$GITHUB_ENV"
echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV"
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
echo "BUILD_VERSION=${RELEASE_BRANCH}-${RELEASE_SHA}" >> "$GITHUB_ENV"
echo "DIST_FILENAME=dist-$RELEASE_BRANCH.zip" >> "$GITHUB_ENV"
# Checkout the HEAD of the PR branch to get the latest commit message.
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get release description
run: |
echo "RELEASE_DESCRIPTION=$(git show -s --format=%s)" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'

- run: yarn install --frozen-lockfile

- name: Build artifacts
run: yarn build
env:
VERSION_FILE_NAME: ${{ github.repository }}
VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }}

- name: Zip project
run: |
zip -r -j ${{ env.DIST_FILENAME }} dist/
- name: Delete existing releases
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}
github_token: ${{ secrets.GITHUB_TOKEN }}


- name: Create or update tag
uses: EndBug/[email protected]
with:
ref: ${{ env.TAG_NAME }}

- name: Create release
id: create-release
uses: softprops/action-gh-release@v1
with:
prerelease: true
target_commitish: ${{ env.RELEASE_SHA }}
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.RELEASE_DESCRIPTION }}
files: ${{ env.DIST_FILENAME }}

- name: Adding summary
run: |
echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY
51 changes: 51 additions & 0 deletions .github/workflows/create-release-on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create release on tag

on:
push:
tags:
- "*"

jobs:
create_release_on_tag:
name: "Create release on tag"
runs-on: ubuntu-latest
steps:
- name: Set release variables
id: resolve-release-vars
run: |
RELEASE_NAME=${{ github.ref_name }}
RELEASE_SHA=${{ github.sha }}
echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV"
echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV"
echo "BUILD_VERSION=${RELEASE_NAME}-${RELEASE_SHA}" >> "$GITHUB_ENV"
echo "DIST_FILENAME=dist-$RELEASE_NAME-$RELEASE_SHA.zip" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'

- run: yarn install --frozen-lockfile

- name: Build artifacts
run: yarn build
env:
VERSION_FILE_NAME: ${{ github.repository }}
VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }}

- name: Zip project
run: |
zip -r -j ${{ env.DIST_FILENAME }} dist/
- name: Create release
id: create-release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.DIST_FILENAME }}

- name: Adding summary
run: |
echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY
68 changes: 0 additions & 68 deletions .github/workflows/release.yml

This file was deleted.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
"@tsconfig/create-react-app": "^1.0.2",
"@types/node": "^20.10.3",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.7",
"@types/react-dom": "^18.2.17",
"@types/react-redux": "^7.1.24",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^6.13.1",
"@vitest/coverage-istanbul": "^0.34.6",
"@typescript-eslint/parser": "^6.13.2",
"@vitest/coverage-istanbul": "^1.0.4",
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"babel-plugin-istanbul": "^6.1.1",
Expand All @@ -90,7 +90,7 @@
"caniuse-lite": "^1.0.30001566",
"chokidar-cli": "^3.0.0",
"concurrently": "^8.2.2",
"core-js": "^3.33.3",
"core-js": "^3.34.0",
"css-loader": "^6.8.1",
"cssnano": "^6.0.1",
"cypress": "^9.6.1",
Expand All @@ -116,7 +116,7 @@
"nyc": "^15.1.0",
"orval": "^6.8.1",
"postcss": "^8.4.32",
"postcss-cli": "^10.1.0",
"postcss-cli": "^11.0.0",
"postcss-loader": "^7.3.3",
"postcss-scss": "^4.0.9",
"prettier": "^2.6.2",
Expand All @@ -128,10 +128,10 @@
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-recommended-scss": "^6.0.0",
"stylelint-prettier": "^2.0.0",
"stylelint-scss": "^5.3.1",
"stylelint-scss": "^5.3.2",
"stylelint-webpack-plugin": "^4.1.1",
"svg-url-loader": "^8.0.0",
"ts-node": "^10.7.0",
"ts-node": "^10.9.2",
"typescript": "^4.6.4",
"vitest": "^0.28.5",
"webpack": "^5.89.0",
Expand All @@ -143,7 +143,7 @@
"prop-types": "Since we use former ddb-react components that depend on prop-types we keep this. Should be removed when usage of prop-types is deprecated."
},
"dependencies": {
"@danskernesdigitalebibliotek/dpl-design-system": "0.0.0-35495a0c14b38577e4fba78e88bfe0e1911790b5",
"@danskernesdigitalebibliotek/dpl-design-system": "0.0.0-751e1ca427e827b1412c0d292cca6df2f43d9453",
"@reach/alert": "^0.17.0",
"@reach/dialog": "^0.18.0",
"@reduxjs/toolkit": "^1.9.7",
Expand All @@ -163,12 +163,12 @@
"react-error-boundary": "^3.1.4",
"react-query": "^3.39.3",
"react-redux": "^8.1.3",
"react-use": "^17.4.1",
"react-use": "^17.4.2",
"redux": "^4.2.1",
"redux-persist": "^6.0.0",
"unfetch": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.4.32"
}
}
}
Loading

0 comments on commit 4d25f89

Please sign in to comment.