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

🚀 Continuous deployment #15

Merged
merged 4 commits into from
Jul 30, 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
50 changes: 48 additions & 2 deletions .github/workflows/ci.yaml → .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Pipeline

on:
push:
Expand All @@ -10,9 +10,24 @@ jobs:
Build:
name: Build
runs-on: ubuntu-latest
outputs:
GitVersion_SemVer: ${{ steps.GitVersion.outputs.GitVersion_SemVer }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full depth (not shallow) for GitVersion and better relevancy of Sonar analysis

- name: Set up GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 6.x

- name: Execute GitVersion
id: GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- name: Use Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -55,7 +70,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: Install production
run: npm ci --include prod
run: npm i --include prod

- name: Build production
run: npm run build
Expand All @@ -71,3 +86,34 @@ jobs:

node dist/main.js "$RUNNER_TEMP/*.css" --dashes
diff --strip-trailing-cr -uI '//.*' src/fixtures/kebab-case/kebab-case-dashes.d.css.ts "$RUNNER_TEMP/kebab-case.d.css.ts"

Publish:
# if: ${{ github.ref == 'refs/heads/main' }}
name: Publish
needs:
- Build # For version variable
- Test # Requires passing tests
runs-on: ubuntu-latest
env:
GitVersion_SemVer: ${{needs.Build.outputs.GitVersion_SemVer}}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .node-version
registry-url: https://registry.npmjs.org

- name: Set version
run: sed -i 's/0.0.0-gitversion/${{ env.GitVersion_SemVer }}/g' package.json

- name: Install
run: npm i --include prod

- name: Publish
run: npm publish --provenance --access public --dryrun
env:
connorjs marked this conversation as resolved.
Show resolved Hide resolved
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ All contributions MUST adhere to the following expectations.

1. Every change MUST have unit tests.
2. Every change MUST have a GitHub issue linked.
3. Any configuration option change MUST be discussed in a GitHub issue first.
4. I will squash-merge the changeset into `main` upon approval.
5. I will publish the new version upon approval (not yet automated).
3. Any configuration option change SHOULD be discussed in a GitHub issue first.
4. The PR build (see [pipeline.yaml](./.github/workflows/pipeline.yaml)) MUST succeed.
5. I will squash-merge the changeset into `main` upon approval.

[RFC2119]: https://www.rfc-editor.org/rfc/rfc2119
[RFC8174]: https://www.rfc-editor.org/rfc/rfc8174
2 changes: 2 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
workflow: GitHubFlow/v1
mode: ContinuousDeployment
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "css-typed",
"version": "0.2.4",
"version": "0.0.0-gitversion",
"description": "Basic TypeScript declaration generator for CSS files",
"keywords": [
"CSS",
Expand Down
Loading