mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
publish master and releases (#1126)
* no artifacts, not required * renamed * cleanup and comments * pass build args * two-step docker build * renamed to as we might push to any docker repo * rename and cleanup * added some docs and expectation about the CI/CD and release information * combined all workflows into steps
This commit is contained in:
parent
7dedd0797c
commit
31971c0c51
62
.github/workflows/ci.yml
vendored
62
.github/workflows/ci.yml
vendored
@ -4,9 +4,6 @@ on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
env:
|
||||
project: 'gun'
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
@ -48,7 +45,7 @@ jobs:
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
# only create a release for tags named 'v*'
|
||||
# create github release
|
||||
release:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [ test ]
|
||||
@ -58,5 +55,60 @@ jobs:
|
||||
# create github release (which triggers the release workflows)
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||
|
||||
# publish latest master or release to dockerhub
|
||||
dockerhub:
|
||||
if: github.event_name == 'push'
|
||||
needs: [ test ]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
image: ${{ secrets.DOCKERHUB_USERNAME }}/gun
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Login
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: echo -n ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
echo "SHA=$GITHUB_SHA"
|
||||
docker build --build-arg SHA=$GITHUB_SHA \
|
||||
BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S') \
|
||||
VCS_REF=${GITHUB_REF} \
|
||||
VCS_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} \
|
||||
VERSION=${GITHUB_REF##*/} \
|
||||
SHA=$GITHUB_SHA \
|
||||
--label "SHA=$GITHUB_SHA" \
|
||||
--tag ${{ env.image }}:${GITHUB_REF##*/} \
|
||||
--tag ${{ env.image }}:latest \
|
||||
.
|
||||
|
||||
- name: Push
|
||||
run: docker push ${{ env.image }}
|
||||
|
||||
|
||||
# publish release to npm
|
||||
npm:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [ test ]
|
||||
# needs: [ release ]
|
||||
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 install
|
||||
npm publish --access=public
|
||||
|
44
.github/workflows/release-dockerhub.yml
vendored
44
.github/workflows/release-dockerhub.yml
vendored
@ -1,44 +0,0 @@
|
||||
name: dockerhub
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
env:
|
||||
project: 'gun'
|
||||
|
||||
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: Build
|
||||
run: |
|
||||
echo "SHA=$GITHUB_SHA"
|
||||
docker build --build-arg \
|
||||
SHA=$GITHUB_SHA \
|
||||
BUILD_DATE=$(date +'%Y-%m-%d') \
|
||||
VCS_REF=${GITHUB_REF/refs\/tags\/v/} \
|
||||
VCS_URL=$GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} \
|
||||
VERSION=${GITHUB_REF/refs\/tags\/v/} \
|
||||
--label "sha=$GITHUB_SHA" \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}:${GITHUB_REF/refs\/tags\/v/} \
|
||||
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}:latest \
|
||||
.
|
||||
|
||||
- name: Push
|
||||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.project }}
|
22
.github/workflows/release-npm.yml
vendored
22
.github/workflows/release-npm.yml
vendored
@ -1,22 +0,0 @@
|
||||
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 install
|
||||
npm publish --access=public
|
25
RELEASE.md
Normal file
25
RELEASE.md
Normal file
@ -0,0 +1,25 @@
|
||||
Every push or pull request will
|
||||
|
||||
- run the tests
|
||||
|
||||
Every push to master will
|
||||
|
||||
- run the tests
|
||||
- publish the latest docker image to dockerhub
|
||||
|
||||
Creating a tag that starts with `v` will
|
||||
|
||||
- create a new github release
|
||||
- publish the release to npm
|
||||
- publish the release to dockerhub
|
||||
|
||||
Creating a release from the github web interface will
|
||||
|
||||
- publish the release to npm
|
||||
- publish the release to dockerhub
|
||||
|
||||
Creating the release for version `0.2021.001` from the command line works as follows
|
||||
|
||||
git tag v0.2021.001
|
||||
git push --tags
|
||||
|
Loading…
x
Reference in New Issue
Block a user