Skip to content

Commit

Permalink
Merge pull request #56 from pmowrer/github-actions
Browse files Browse the repository at this point in the history
Replace defunct Travis CI setup with GitHub actions.
  • Loading branch information
pmowrer authored Jan 16, 2024
2 parents 8d7a71c + b7051ea commit 967e54e
Show file tree
Hide file tree
Showing 6 changed files with 2,805 additions and 3,308 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release preview
on: [pull_request]
jobs:
release-preview:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
# semantic-release dry-run workaround https://github.com/semantic-release/semantic-release/issues/1890#issuecomment-974512960
- run: git checkout -b ${{ github.head_ref }}
- run: unset GITHUB_ACTIONS && yarn && node ./bin/semantic-release-github-pr --debug
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release

on:
pull_request:
branches:
- master
types:
- closed

jobs:
release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npx semantic-release --debug
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Tests
on: [pull_request]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn && yarn test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# semantic-release-github-pr

[![Build Status](https://travis-ci.org/pmowrer/semantic-release-github-pr.svg?branch=master)](https://travis-ci.org/pmowrer/semantic-release-github-pr) [![npm](https://img.shields.io/npm/v/semantic-release-github-pr.svg)](https://www.npmjs.com/package/semantic-release-github-pr) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Tests workflow](https://github.com/pmowrer/semantic-release-github-pr/actions/workflows/tests.yaml/badge.svg)](https://travis-ci.org/pmowrer/semantic-release-github-pr) [![npm](https://img.shields.io/npm/v/semantic-release-github-pr.svg)](https://www.npmjs.com/package/semantic-release-github-pr) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

Preview the semantic release notes that would result from merging a Github PR.

Expand Down
6 changes: 1 addition & 5 deletions bin/semantic-release-github-pr.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/usr/bin/env node
const execa = require('execa');
const envCi = require('env-ci');
const { argv } = process;
const { resolve } = require('path');
const { getCurrentBranchName } = require('../src/git-utils');

(async function() {
const plugins = `${resolve(__dirname, '../src/index.js')}`;
const currentBranchName = await getCurrentBranchName();
// If we're in a "detached HEAD" state, assume we're running on CI.
const branch =
currentBranchName !== 'HEAD' ? currentBranchName : envCi().prBranch;
const branch = await getCurrentBranchName();

const args = argv.slice(2).concat([
// We want to run on pull request builds, but `semantic-release` won't
Expand Down
Loading

0 comments on commit 967e54e

Please sign in to comment.