Skip to content

Commit

Permalink
fix(actions): snapshot action
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelramos committed Jan 30, 2024
1 parent 0819f95 commit a565550
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"useCalculatedVersion": true,
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "SNAPSHOT-{commit}"
"prereleaseTemplate": "{commit}-SNAPSHOT"
}
}
2 changes: 1 addition & 1 deletion .github/actions/node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup node cache
with:
path: .node
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/npmrc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Npmrc Action"
description: "Create npmrc file"
author: "xxxxx@github.com"

inputs:
github-token:
description: 'Github token'
required: true

runs:
using: "composite"
steps:
- name: Setup CI Git User
shell: bash
run: |
git config --global user.name "miguelramos"
git config --global user.email "miguel.ramos@websublime.dev"
cat << EOF > "$HOME/.npmrc"
//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
@websublime:registry=https://npm.pkg.github.com
EOF
env:
GITHUB_TOKEN: ${{ inputs.github-token }}

branding:
icon: "shield"
color: "blue"
2 changes: 1 addition & 1 deletion .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
shell: bash
run: pnpm config set store-dir ${{ inputs.cache-folder }}

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ inputs.cache-folder }}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: pull_request
env:
CI: true

run-name: Build ${{ github.event.pull_request.head.ref }} by @${{ github.actor }}
run-name: '[Build]: ${{ github.event.pull_request.head.ref }} by @${{ github.actor }}'

jobs:
build:
Expand All @@ -18,11 +18,6 @@ jobs:
fetch-depth: 0
ref: feature/reusable-actions

- name: Test
shell: bash
run: |
echo ${{ secrets.NPM_TOKEN }}
- name: Install pnpm package manager
id: install-pnpm
uses: ./.github/actions/pnpm
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy Snapshots

on: workflow_dispatch

env:
CI: true

run-name: '[Snapshots]: ${{ github.ref_name }} by @${{ github.actor }}'

jobs:
build:
name: Snapshot
runs-on: ubuntu-latest
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: feature/reusable-actions

- name: Install pnpm package manager
id: install-pnpm
uses: ./.github/actions/pnpm
with:
npm-token: ${{ secrets.NPM_TOKEN }}

- name: Install NodeJs
id: install-node
uses: ./.github/actions/node

- name: Build Packages
id: build-packages
uses: ./.github/actions/build

- name: Setup CI Git User
id: setup-ci-git-user
uses: ./.github/actions/npmrc
with:
github-token: ${{ secrets.GH_TOKEN }}

- name: Create Snapshot
uses: changesets/action@v1.4.5
with:
setupGitUser: false
version: pnpm snapshot:version
publish: pnpm snapshot:publish
title: "Snapshot Release"
commit: "chore(release): snapshot release"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.GH_TOKEN }}

0 comments on commit a565550

Please sign in to comment.