mirror of
https://github.com/amark/gun.git
synced 2026-03-09 18:33:10 +00:00
added ci, artifact cleanup, and pushing releases to dockerhub and npm
This commit is contained in:
75
.github/ci.yml
vendored
Normal file
75
.github/ci.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: ci
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
project: 'release-node'
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x, 14.x]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# verify the version in package.json matches the release tag
|
||||
- name: Version
|
||||
uses: tcurdt/action-verify-version-npm@master
|
||||
|
||||
- name: Setup Node ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Cache
|
||||
id: cache-modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
|
||||
|
||||
- name: Install
|
||||
if: steps.cache-modules.outputs.cache-hit != 'true'
|
||||
run: npm install
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
# create release artifacts to publish as github release
|
||||
# - name: Upload
|
||||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: ${{ env.project }}_${{ matrix.os }}_${{ matrix.node-version }}
|
||||
# path: |
|
||||
# !.git
|
||||
# !.github
|
||||
# !node_modules
|
||||
# .
|
||||
|
||||
release:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
# - name: Download
|
||||
# uses: actions/download-artifact@v2
|
||||
# with:
|
||||
# path: artifacts
|
||||
# - name: Archives
|
||||
# run: find artifacts -mindepth 1 -maxdepth 1 -exec tar -C {} -cvzf {}.tgz . \;
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# with:
|
||||
# files: |
|
||||
# artifacts/*.tgz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||
17
.github/cleanup.yml
vendored
Normal file
17
.github/cleanup.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: cleanup
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '1 1 * * 1' # once a week clean out old artifacts
|
||||
|
||||
jobs:
|
||||
|
||||
expire:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Expire Artifacts
|
||||
uses: kolpav/purge-artifacts-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
expire-in: 1hour
|
||||
35
.github/dockerhub.yml
vendored
Normal file
35
.github/dockerhub.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: dockerhub
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
project: 'release-node'
|
||||
|
||||
jobs:
|
||||
|
||||
dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
docker build -t ${{ env.project }} .
|
||||
|
||||
- name: Login
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
- name: Tag
|
||||
run: |
|
||||
docker tag ${{ env.project }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}:${GITHUB_REF/refs\/tags\/v/}
|
||||
docker tag ${{ env.project }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}:latest
|
||||
|
||||
- name: Push
|
||||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}
|
||||
21
.github/npm.yml
vendored
Normal file
21
.github/npm.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: npm
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Publish
|
||||
env:
|
||||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
|
||||
npm publish --access=public
|
||||
Reference in New Issue
Block a user