Skip to content

Release 1.0.0-beta.2 #9

Release 1.0.0-beta.2

Release 1.0.0-beta.2 #9

Workflow file for this run

name: Creation de la release
on:
push:
tags:
- '*'
env:
MODULE_NAME: modules
BUNDLE_NAME: bundle
PACKAGE_NAME: package
jobs:
# - checkout master ou main
# - build des binaires
# - build package des sources
# - build jsdoc
# - zip & upload artifacts :
# - jsdoc
# - dist
# - package.zip
# - modules.zip
# - bundle.zip
build: # Only for tags !
if: github.event_name == 'push' && contains(github.ref, '/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use nodejs
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build bundles & modules
run: npm run build
- name: Build package
run: npm run publish -- --version=${{ github.ref_name }}
- name: Create Zip Modules
run: |
zip --junk-paths ${{env.MODULE_NAME}} dist/${{env.MODULE_NAME}}/*
- name: Create Zip Bundle
run: |
zip --junk-paths ${{env.BUNDLE_NAME}} dist/${{env.BUNDLE_NAME}}/*
- name: Create Zip Package
run: |
cd dist/package/
zip -r ../../${{env.PACKAGE_NAME}}.zip * -x "*.tgz"
- name: Upload JSDoc artifacts
uses: actions/upload-artifact@v4
with:
name: jsdoc
path: jsdoc
- name: Upload Binaries artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: Upload Package artifacts
uses: actions/upload-artifact@v4
with:
name: package
path: ${{env.PACKAGE_NAME}}.zip
- name: Upload Bundle artifacts
uses: actions/upload-artifact@v4
with:
name: bundle
path: ${{env.BUNDLE_NAME}}.zip
- name: Upload Modules artifacts
uses: actions/upload-artifact@v4
with:
name: modules
path: ${{env.MODULE_NAME}}.zip
# - checkout gh-pages
# - download des artifacts : build & jsdoc
# - commit & push
# warning: ceci risque de declencher un deploy automatique !
# > CUSTOMISER LE DEPLOY ET METTRE UNE CONDITION D'EXECUTION !
deploy: # Only for tags !
if: github.event_name == 'push' && contains(github.ref, '/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: gh-pages
- name: Download Binaries artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Download JSDoc artifacts
uses: actions/download-artifact@v4
with:
name: jsdoc
path: jsdoc
- name: Build 404
run: |
cp index.html 404.html
- name: Publish
run: |
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "[github-actions] deploy project gh-pages"
git push
# - checkout master or main
# - get date from package.json
# - get version from package.json
# - create changelog, then upload artifact changelog (also use by publish npm)
# - create release github
# - download binaries (from build)
# - upload artifacts for release github assets :
# - bundle.zip
# - modules.zip
# - package.zip
release: # Only for tags !
if: github.event_name == 'push' && contains(github.ref, '/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Package info
id: package
uses: idev-coder/[email protected]
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Create ChangeLog
run: |
echo "version package internal : ${{ steps.package.outputs.version }}"
sed -i 's/__VERSION__/${{ github.ref_name }}/g' DRAFT_CHANGELOG.md
sed -i 's/__DATE__/${{ steps.date.outputs.date }}/g' DRAFT_CHANGELOG.md
- name: Upload ChangeLog artifacts
uses: actions/upload-artifact@v4
with:
name: changelog
path: DRAFT_CHANGELOG.md
- name: Download Bundle artifacts
uses: actions/download-artifact@v4
with:
name: ${{env.BUNDLE_NAME}}
path: ./
- name: Download Module artifacts
uses: actions/download-artifact@v4
with:
name: ${{env.MODULE_NAME}}
path: ./
- name: Download Package artifacts
uses: actions/download-artifact@v4
with:
name: ${{env.PACKAGE_NAME}}
path: ./
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: DRAFT_CHANGELOG.md
draft: false
prerelease: false
- name: Upload Release Asset Bundles
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{env.BUNDLE_NAME}}.zip
asset_name: ${{env.BUNDLE_NAME}}.zip
asset_content_type: application/zip
- name: Upload Release Asset Modules
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{env.MODULE_NAME}}.zip
asset_name: ${{env.MODULE_NAME}}.zip
asset_content_type: application/zip
- name: Upload Release Asset Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{env.PACKAGE_NAME}}.zip
asset_name: ${{env.PACKAGE_NAME}}.zip
asset_content_type: application/zip
# - checkout master or main
# - download changelog (from release)
# - download package (from build)
# - then simply publish repo
publish: # Only for tags !
if: github.event_name == 'push' && contains(github.ref, '/tags/')
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Binaries artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Download ChangeLog artifacts
uses: actions/download-artifact@v4
with:
name: changelog
path: ./dist/package/CHANGELOG.md
- name: Use registry npm
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish on npm
run: |
cd ./dist/package
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GEOPORTAL_TOKEN }}
# - checkout master or main
# - download changelog (from release)
# - archive changelog
# - update toc
# - reset draft changelog
# - commit & push
# warning: ceci risque de relancer un job de build et deploy du build.yaml !
# on positionne une condition sur le message du commit afin d'éviter de reexecuter les jobs
changelog: # Only for tags !
if: github.event_name == 'push' && contains(github.ref, '/tags/')
needs: [release, publish]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: main
token: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
- name: Download ChangeLog artifacts
uses: actions/download-artifact@v4
with:
name: changelog
- name: Install Libs
run: |
npm install markdown-toc
- name: Archive changelog
run: |
cat DRAFT_CHANGELOG.md >> CHANGELOG.md
./node_modules/.bin/markdown-toc -i CHANGELOG.md
- name: Reset draft changelog
run: |
cp .github/CHANGELOG_TEMPLATE.md DRAFT_CHANGELOG.md
- name: Commit and push
run: |
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "[github-actions] update CHANGELOG"
git push --force
# not yet implemented !
# - checkout master or main
# - simply update package.json with new version
# - commit & push
samples:
if: false
runs-on: ubuntu-latest
steps:
- name: ras
run: |
echo "not yet implemented !"
# not yet implemented !
rollback:
if: false
runs-on: ubuntu-latest
steps:
- name: ras
run: |
echo "not yet implemented !"