Skip to content

Commit

Permalink
fix: releasing itself
Browse files Browse the repository at this point in the history
  • Loading branch information
kristof-mattei committed Sep 27, 2023
1 parent e137594 commit daf187d
Show file tree
Hide file tree
Showing 11 changed files with 68,939 additions and 71 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

concurrency:
group: "${{ github.workflow }}"
cancel-in-progress: true # only last step is important, which runs or doesn't

on:
workflow_dispatch: # releasing is manual as we don't want to release every time

permissions:
contents: write # to write tags
packages: write # to write tags to Docker registry
issues: write
pull-requests: write
id-token: write # to enable use of OIDC for npm provenance

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Only on main
if: github.ref != 'refs/heads/main'
shell: bash
run: |
echo "Only to be executed on main"
exit 1
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
show-progress: false

- name: Setup Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: "**/package-lock.json"

- name: Install dependencies
shell: bash
run: |
npm ci --ignore-scripts
- name: Build
shell: bash
run: |
npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
npm run release
52 changes: 52 additions & 0 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test Release (do a dry run)

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

on:
workflow_dispatch: # releasing is manual as we don't want to release every time

permissions:
contents: write
issues: read
pull-requests: read

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Only on main
if: github.ref != 'refs/heads/main'
shell: bash
run: |
echo "Only to be executed on main"
exit 1
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
show-progress: false

- name: Setup Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: "**/package-lock.json"

- name: Install dependencies
shell: bash
run: |
npm ci --ignore-scripts
- name: Release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run release -- --dry-run
9 changes: 9 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
- preset: conventionalcommits
- "@semantic-release/github"
branches:
- name: main
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"jest.autoRevealOutput": "on-run",
"jest.jestCommandLine": "node_modules/.bin/jest",
"jest.showCoverageOnLoad": true
}
68,702 changes: 68,697 additions & 5 deletions dist/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config: Config = {
collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ["<rootDir>/src/**/*.ts"],
collectCoverageFrom: ["<rootDir>/src/**/*.ts", "!<rootDir>/src/**/*.d.ts"],

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
Expand Down Expand Up @@ -90,7 +90,7 @@ const config: Config = {
reporters: ["default"],

// Automatically reset mock state between every test
// resetMocks: false,
resetMocks: true,

// Reset the module registry before running each individual test
// resetModules: false,
Expand All @@ -99,7 +99,7 @@ const config: Config = {
// resolver: undefined,

// Automatically restore mock state between every test
// restoreMocks: false,
restoreMocks: true,

// The root directory that Jest should scan for tests and modules within
rootDir: "./",
Expand Down
Loading

0 comments on commit daf187d

Please sign in to comment.