diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..0eb7126 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..68baac4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: Publish Package to npmjs +run-name: ${{ github.actor }} publish to npm 🚀 + +on: + push: + tags: + - "v*.*.*" +jobs: + # Then release to npm + build: + name: Lint and build + runs-on: ubuntu-latest + + # needs: [build-test] # Require standard CI steps to pass before publishing + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + # Set up .npmrc file to publish to npm. This also allows NODE_AUTH_TOKEN + # to work below. + - name: Install Nodejs + uses: actions/setup-node@v4 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + + - name: Setup Yarn in Node + uses: actions/setup-node@v4 + with: + cache: "yarn" # uses the system node, which was updated prior. + + - name: Install dependencies + run: yarn + + - name: Lint and clean code + run: yarn lint + + - name: Build + run: yarn build + + # Then release to npm + release: + if: ${{ github.ref == 'refs/heads/main' }} + name: Publish + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write # Needed for https://docs.npmjs.com/generating-provenance-statements + strategy: + matrix: + node-version: [18] + + + needs: [build] # Require standard CI steps to pass before publishing + + steps: + # - name: Checkout repo + # run: echo "${{ github.event_name }} on ${{ github.ref }}." + + - name: Checkout repo + uses: actions/checkout@v4 + + # Set up .npmrc file to publish to npm. This also allows NODE_AUTH_TOKEN + # to work below. + - name: Install Nodejs + uses: actions/setup-node@v4 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + + # - name: Setup Yarn in Node + # uses: actions/setup-node@v4 + # with: + # cache: "yarn" # uses the system node, which was updated prior. + + - name: yarn publish --provenance + # - run: yarn publish --provenance + uses: ./ + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index b14f044..8ef3dce 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "email": "tiavinamika@gmail.com", "github": "https://github.com/tiavina-mika" }, - "version": "0.1.36", + "version": "0.1.4", "license": "MIT", "type": "module", "types": "./dist/index.d.ts",