Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set main branch as default and update GitHub actions #549

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test, Lint, Release and Publish
on:
push:
branches:
- main
jobs:
main:
name: Release and publish Node package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install and test
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm test

- name: Extract version
id: extract_version
uses: Saionaro/[email protected]

- name: Get latest tag
id: get_latest_tag
uses: actions-ecosystem/action-get-latest-tag@v1

- name: See if version changed
run: |
if [[ "v${{ steps.extract_version.outputs.version }}" == "${{ steps.get_latest_tag.outputs.tag }}" ]]; then
echo "VERSION_CHANGED=false" >> "$GITHUB_ENV"
else
echo "VERSION_CHANGED=true" >> "$GITHUB_ENV"
fi

- name: Create tag
uses: rickstaa/action-create-tag@v1
if: env.VERSION_CHANGED == 'true'
with:
tag: "v${{ steps.extract_version.outputs.version }}"

- name: Create release
if: env.VERSION_CHANGED == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: 'v${{ steps.extract_version.outputs.version }}'
generate_release_notes: 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish new version
if: env.VERSION_CHANGED == 'true'
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
# as it appears actions/setup-node sets own value
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --verbose

- name: Print dirs
if: failure()
run: find /home/runner/.npm/_logs/ -type f -exec cat {} \;
54 changes: 0 additions & 54 deletions .github/workflows/test-build-publish.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test and Optionally Publish
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14.x, 16.x, 18.x ]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run lint
- run: npm test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# serverless-domain-manager
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)
[![Build Status](https://travis-ci.org/amplify-education/serverless-domain-manager.svg?branch=master)](https://travis-ci.org/amplify-education/serverless-domain-manager)
[![Build Status](https://travis-ci.org/amplify-education/serverless-domain-manager.svg?branch=main)](https://travis-ci.org/amplify-education/serverless-domain-manager)
[![npm version](https://badge.fury.io/js/serverless-domain-manager.svg)](https://badge.fury.io/js/serverless-domain-manager)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/amplify-education/serverless-domain-manager/master/LICENSE)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/amplify-education/serverless-domain-manager/main/LICENSE)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/235fe249b8354a3db0cc5926dba47899)](https://www.codacy.com/gh/amplify-education/serverless-domain-manager/dashboard?utm_source=github.com&utm_medium=referral&utm_content=amplify-education/serverless-domain-manager&utm_campaign=Badge_Grade)
[![npm downloads](https://img.shields.io/npm/dt/serverless-domain-manager.svg?style=flat)](https://www.npmjs.com/package/serverless-domain-manager)

Expand Down