Skip to content

Commit

Permalink
Merge pull request #128 from Geoportail-Luxembourg/GSLUX-635_create_r…
Browse files Browse the repository at this point in the history
…elease_CI

create release in workflow => attach bundle
  • Loading branch information
mki-c2c authored Aug 8, 2024
2 parents c8b0be7 + 349e70a commit 84c9eea
Show file tree
Hide file tree
Showing 29 changed files with 74 additions and 45,426 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci_bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI_package
on:
push:
tags:
- '*'
jobs:
lux-package:
runs-on: ubuntu-latest
steps:
- name: create release
id: create_release
uses: octokit/request-action@v2.x
with:
# secrets.GITHUB_TOKEN is a secret only valid for one CI execution
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
route: POST /repos/{owner}/{repo}/releases
owner: 'Geoportail-Luxembourg'
repo: 'luxembourg-geoportail'
tag_name: ${{ github.ref }}
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Build and pack prod library
shell: bash
run: |
npm ci
npm run build:lib:prod
npm pack
- name: upload manually
run: |
project_name=$(npm run env | grep "npm_package_name" | sed s/npm_package_name=//)
pkg_name=$(ls $project_name-*)
lib_name=$(echo $pkg_name | sed s/luxembourg-geoportail-/luxembourg-geoportail-lib-/)
curl -X POST "https://uploads.github.com/repos/$owner/$repo/releases/$id/assets?name=$lib_name" --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary "@$pkg_name"
env:
owner: 'Geoportail-Luxembourg'
repo: 'luxembourg-geoportail'
id: ${{ fromJSON(steps.create_release.outputs.data).id }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# build
/_site/
/dist/
/bundle
/out-tsc/
.parcel-cache

Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ When Lux is used in lib mode 📦, it is possible to oerride i18next configurati

## 📦 Build as a lib for integration (in geoportal v3)

In order to use the new Lux components made with Vuejs as an external dep, follow steps below.
In order to use the new Lux components made with Vuejs as an external dep, the library must be built and imported in the V3 project.

### Build the lib
### Manual Build

In the project **luxembourg-geoportail**, build the app as library with this command:

Expand All @@ -91,6 +91,27 @@ To see what are the components exported, check the `/src/bundle/lib.ts` that is

The build configuration can be found in `vite-dist.config`. It excludes `OpenLayers` and `mapbox-gl` from the lib to prevent problems (eg. in minification) when running the lib within v3. The lib uses the `ol` and `mapbox-gl` instances of v3, which versions should be similar to those in v4.

The results of the build can be found in the folder `bundle`

### Automatic build via CI

An automatic mecanism has been created with github actions. This workflow is triggered when a tag is pushed into the repo.

For the moment there is no automatic tag generation on pull requests, so for dev, the following naming conventions are recommended:
<branch_name>\_tag\_<short_commit>

```
echo $(git rev-parse --abbrev-ref HEAD)_tag_$(git rev-parse --short HEAD)
```

The CI automatically builds the lib, creates a release named after the tag and includes the built bundle in the release. The built package can then be downloaded at the URL:

```
"https://github.com/Geoportail-Luxembourg/luxembourg-geoportail/releases/download/<release_name>/luxembourg-geoportail-lib-0.0.0-dev.tgz"
```

This package URL can also be used to reference the dependency for NPM in package.json, see below

### Import the lib in another app

You can include the built lib multiple ways in the `package.json`:
Expand All @@ -107,8 +128,7 @@ You can include the built lib multiple ways in the `package.json`:
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"luxembourg-geoportail": "git://github.com/Geoportail-Luxembourg/luxembourg-geoportail.git#GSLUX-602-IntegrationV3"
// or "https://github.com/Geoportail-Luxembourg/luxembourg-geoportail.git#GSLUX-602-IntegrationV3"
"luxembourg-geoportail": "ttps://github.com/Geoportail-Luxembourg/luxembourg-geoportail/releases/download/GSLUX-635_create_release_CI_6606389/luxembourg-geoportail-lib-0.0.0-dev.tgz"
},
"devDependencies": {
// ...
Expand Down
52 changes: 0 additions & 52 deletions bundle/assets/locales/app.de.json

This file was deleted.

52 changes: 0 additions & 52 deletions bundle/assets/locales/app.en.json

This file was deleted.

52 changes: 0 additions & 52 deletions bundle/assets/locales/app.fr.json

This file was deleted.

52 changes: 0 additions & 52 deletions bundle/assets/locales/app.lb.json

This file was deleted.

Loading

0 comments on commit 84c9eea

Please sign in to comment.