Create release ... #35
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: Create release ... | |
on: | |
push: | |
tags: | |
- '*' | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use nodejs | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Build production | |
run: npm run build:prod | |
- name: Build development | |
run: npm run build:dev | |
- name: ESlint | |
run: npm run eslint | |
- name: Units test | |
run: npm run cover | |
- name: Build package # FIXME inutile ou commit ? | |
run: npm pack | |
- name: Create Zip # FIXME inutile ? | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
run: | | |
zip --junk-paths bundles dist/* | |
- name: Upload JSDoc artifacts | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jsdoc | |
path: jsdoc | |
- name: Upload Binary artifacts | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Upload Bundles artifacts # FIXME inutile ? | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
uses: actions/upload-artifact@v2 | |
with: | |
name: bundles | |
path: bundles.zip | |
- name: Upload Reporter Coverage artifacts | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage | |
path: coverage/lcov-report | |
- name: Upload Reporter Test artifacts | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-report | |
path: test-report | |
publish_gh-pages: | |
# if: false | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: IGNF/geoportal-access-lib | |
ref: gh-pages | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(echo v${GITHUB_REF##*/}) | |
- name: Initialize | |
run: | | |
mkdir -p tmp/jsdoc | |
mkdir -p tmp/dist | |
mkdir -p tmp/coverage | |
mkdir -p tmp/test-report | |
mkdir ${{ steps.get_version.outputs.VERSION }} | |
- name: Download JSDoc artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: jsdoc | |
path: tmp/jsdoc | |
- name: Build jsdoc | |
run: | | |
cp -r tmp/jsdoc current | |
cp -r tmp/jsdoc ${{ steps.get_version.outputs.VERSION }} | |
- name: Download bundles artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: tmp/dist | |
- name: Build bundles | |
run: | | |
cp -r tmp/dist current | |
cp -r tmp/dist ${{ steps.get_version.outputs.VERSION }} | |
- name: Link versions | |
run: | | |
rm latest | |
ln -s ${{ steps.get_version.outputs.VERSION }} latest | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: coverage | |
path: tmp/coverage | |
- name: Build coverage | |
run: | | |
rm -rf current/coverage | |
cp -r tmp/coverage current | |
- name: Download test-report artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: test-report | |
path: tmp/test-report | |
- name: Build test-report | |
run: | | |
rm -rf current/test-report | |
cp -r tmp/test-report current | |
- name: Clean and publish | |
run: | | |
rm -rf tmp/ | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
git commit -m "update jsdoc and bundles to release ${{ steps.get_version.outputs.VERSION }}" | |
git push | |
create_release: | |
# if: false | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1.1.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body_path: DRAFT_CHANGELOG.md | |
draft: false | |
prerelease: false | |
- name: Download bundles artifacts # FIXME inutile ? | |
uses: actions/download-artifact@v2 | |
with: | |
name: bundles | |
- name: Download bundles artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
- name: Upload Release Asset (bundles) # FIXME inutile ? | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN}} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bundles.zip | |
asset_name: bundles.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset (1) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./GpServices.js | |
asset_name: GpServices.js | |
asset_content_type: application/javascript | |
- name: Upload Release Asset (2) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./GpServices-src.js | |
asset_name: GpServices-src.js | |
asset_content_type: application/javascript | |
- name: Upload Release Asset (3) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./GpServices-map.js | |
asset_name: GpServices-map.js | |
asset_content_type: application/javascript | |
publish_package: | |
# if: false | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
needs: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Initialize | |
run: | | |
mkdir dist | |
- name: Download bundles artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Use registry npm | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
registry-url: 'https://registry.npmjs.org' | |
# scope: '@ignf-geoportal' | |
- name: Publish on npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_GEOPORTAL_TOKEN }} | |
publish_samples: | |
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags ! | |
needs: publish_package | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: IGNF/geoportal-access-lib-samples | |
ref: master | |
token : ${{ secrets.ADMIN_GEOPORTAL_TOKEN }} | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(echo ${GITHUB_REF##*/}) | |
- name: Update package.json | |
run: | | |
sed -i -e "s/\"geoportal-access-lib\": \".*\"/\"geoportal-access-lib\": \"${{ steps.get_version.outputs.VERSION }}\"/" package.json | |
- name: Publish | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
git commit -m "update geoportal-access-lib release v${{ steps.get_version.outputs.VERSION }}" | |
git push | |