diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cd88ab6..025059a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,5 +5,3 @@ FROM mcr.microsoft.com/devcontainers/base:alpine-${ALPINE_VERSION} ARG NODE_VERSION RUN apk update && apk add --no-cache nodejs=${NODE_VERSION} npm - -WORKDIR /workspaces/datc diff --git a/.env b/.env index 8ff1f34..9ea7acd 100644 --- a/.env +++ b/.env @@ -1,2 +1 @@ -NODE_VERSION=20.15 -UBUNTU_VERSION=20.04 \ No newline at end of file +NODE_VERSION=20.15 \ No newline at end of file diff --git a/.github/workflows/deploy-storybook.yml b/.github/workflows/cd-pipeline.yml similarity index 51% rename from .github/workflows/deploy-storybook.yml rename to .github/workflows/cd-pipeline.yml index 4c7cb20..2511b8c 100644 --- a/.github/workflows/deploy-storybook.yml +++ b/.github/workflows/cd-pipeline.yml @@ -1,21 +1,21 @@ -name: Storybook to GitHub Pages Pipeline +name: Continuous Deployment Pipeline + +permissions: + contents: write + pages: write + id-token: write on: push: branches: - production -permissions: - contents: read - pages: write - id-token: write - concurrency: group: "pages" cancel-in-progress: true jobs: - deploy: + deploy-storybook-to-github-pages: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -50,3 +50,34 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 + + publish-package-to-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: "https://registry.npmjs.org" + + - name: Install dependencies + run: npm ci + + - name: Get version + id: package-version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + + - name: Create and push tag + run: | + git tag v${{ steps.package-version.outputs.version }} + git push origin v${{ steps.package-version.outputs.version }} + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml deleted file mode 100644 index 67c1e29..0000000 --- a/.github/workflows/publish-package.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Publish Package to NPM - -permissions: - contents: write - -on: - push: - branches: - - production - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.15" - registry-url: "https://registry.npmjs.org" - - - name: Install dependencies - run: npm ci - - - name: Get version - id: package-version - run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT - - - name: Create and push tag - run: | - git tag v${{ steps.package-version.outputs.version }} - git push origin v${{ steps.package-version.outputs.version }} - - - name: Publish to NPM - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/check-version.yml b/.github/workflows/version-pipeline.yml similarity index 91% rename from .github/workflows/check-version.yml rename to .github/workflows/version-pipeline.yml index 6a0ab0b..5925cf0 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/version-pipeline.yml @@ -1,4 +1,4 @@ -name: Version Check +name: Versioning Pipeline on: pull_request: @@ -6,7 +6,7 @@ on: - production jobs: - version-check: + check: runs-on: ubuntu-latest steps: