From a6c94de60ae202787a6f333e3fa2dd89ea0a7981 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Mon, 29 Apr 2024 16:50:46 +0100 Subject: [PATCH] chore: add publish pipeline [INS-3792] --- .github/workflows/publish.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..cfbfb8bc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,56 @@ +name: Publish httpsnippet + +on: + workflow_dispatch: + inputs: + version: + description: 'Tag version to release' + required: true + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.9.0 + registry-url: 'https://registry.npmjs.org' + + - name: Configure Git user + uses: Homebrew/actions/git-user-config@master + with: + username: ${{ (github.event_name == 'workflow_dispatch' && github.actor) || 'insomnia-infra' }} + + - name: Tag the Repository + run: | + git tag ${{ github.event.inputs.version }} + git push origin ${{ github.event.inputs.version }} + + - name: Create Tag and Release + uses: ncipollo/release-action@v1 + id: core_tag_and_release + with: + tag: ${{ github.event.inputs.version }} + name: "httpsnippet ${{ github.event.inputs.version }} 📦" + generateReleaseNotes: true + prerelease: false + draft: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install + run: npm ci + + - name: Build + run: npm run build + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}