Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/303 repository improvement #305

Merged
merged 9 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 39 additions & 35 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
name: Generate new release
# Workflow base: https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions

name: Publish release

on:
push:
tags:
- 'v1*'
workflow_run:
workflows: ["Run tests"]
branches:
AntoninoBonanno marked this conversation as resolved.
Show resolved Hide resolved
- main
types:
- completed

permissions:
contents: read # for checkout

jobs:
build:
release:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: git config
- name: Install dependencies
run: npm ci
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Build library
run: npm run build:lib
- name: Copy readme and npmrc files to dist folder
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: mv .npmrc-dist .npmrc
- run: npm ci
- run: npm run build:lib
- name: Publish package to NPM
run: cp .npmrc dist/design-angular-kit/.npmrc && cd dist/design-angular-kit && npm publish --tag unstable
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm i extract-changelog-release
- name: Generate Release Body
run: npx extract-changelog-release > RELEASE_BODY.md
- uses: ncipollo/release-action@v1
with:
bodyFile: 'RELEASE_BODY.md'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish on gh-pages
run: |
npm run build
cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run documentation-deploy-to-gh-pages
cp README.md dist/design-angular-kit/README.md
cp .npmrc dist/design-angular-kit/.npmrc

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: italia/[email protected]
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
project_name: Design Angular Kit
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
branches:
- main
name: CI

jobs:
run-build-and-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm i
- run: npm ci
- run: npm run build
- run: npm run build:lib
- run: npm run test
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/slack-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Slack notification

on:
push:
tags:
- 'v1*'

jobs:
notification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Notify new release on Slack
uses: italia/[email protected]
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
project_name: Design Angular Kit
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
name: Update documentation

on:
workflow_dispatch:
workflow_run:
workflows: ["Publish release"]
branches:
- main
types:
- completed

jobs:
build:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: git config
- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: npm ci
- run: npm run build
- run: cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html

- name: Install dependencies
run: npm ci

- name: Build documentation
run: |
npm run build
cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html

- name: Publish on gh-pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
Expand Down
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
message="chore(release): %s :tada:"
registry=https://registry.npmjs.org/
always-auth=true
tag=unstable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quando bisogna rilasciare la versione stabile: rimuovere tag=unstable

4 changes: 0 additions & 4 deletions .npmrc-dist

This file was deleted.