Skip to content

Release

Release #1975

Workflow file for this run

name: Release
on:
schedule:
- cron: "00 21 * * *"
repository_dispatch:
types: manual_release
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Set up Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Get yarn cache directory path
id: init
shell: bash
run: |
echo "::set-output name=yarn_cache::$(yarn cache dir)"
#
echo "Node $(node --version)"
echo "Yarn $(yarn --version)"
- uses: actions/checkout@v3
- name: Cache Yarn packages
id: yarn_cache_packages
uses: actions/cache@v3
with:
path: ${{ steps.init.outputs.yarn_cache }}
key: ${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn_cache-
- name: Installing
run: yarn --frozen-lockfile --link-duplicates --prefer-offline
- name: Build
run: yarn build
- name: Start
env:
TOKEN_MT: ${{ secrets.TOKEN_MT }}
DATAFILLER_URL: ${{ secrets.DATAFILLER_URL }}
run: yarn start
- name: Check Refs
run: yarn checkRefs
- name: Get metadata
id: metadata
shell: bash
run: |
echo "::set-output name=data_status::$(git status -s ./data)"
echo "::set-output name=now::$(date +"%Y%m%d_%H%M")"
- name: Print metadata
run: |
echo "Data status ${{ steps.metadata.outputs.now }}"
echo "${{ steps.metadata.outputs.data_status }}"
- name: Check JSON
run: |
for filename in ./data/*\.json; do
node "$filename" > /dev/null || {
echo "Error: Invalid JSON in $filename"
exit 1
}
done
- uses: EndBug/add-and-commit@v7
if: ${{ steps.metadata.outputs.data_status }}
env:
HUSKY_SKIP_HOOKS: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
author_name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
author_email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
message: "feat(data): ${{ steps.metadata.outputs.now }} update"
add: "data"
- name: Set Registry token
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
env:
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}
- uses: mattermost/action-mattermost-notify@master
if: failure()
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
TEXT: |
La mise à jour du dépôt fiches-travail-data a échoué.
[Les logs sont disponibles ici](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})