mirror of https://github.com/thumbsup/thumbsup
chore: cleanup Github workflows and replace Travis CI
parent
0218f90f38
commit
421f1eef2a
@ -0,0 +1,47 @@
|
||||
name: Publish NPM package
|
||||
|
||||
# This workflow runs every time a version tag is pushed
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
|
||||
# Publish the npm package
|
||||
publish:
|
||||
name: Publish package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: npm publish --ignore-scripts
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
|
||||
# Create a Github release
|
||||
release:
|
||||
name: Create release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Get the version
|
||||
id: version
|
||||
run: echo ::set-output name=tag::${GITHUB_REF:10}
|
||||
- name: Generate change log
|
||||
run: scripts/changelog ${{ steps.version.outputs.tag }} > CHANGELOG.md
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: "Release ${{ steps.version.outputs.tag }}"
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
@ -1,35 +0,0 @@
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
name: Create Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 100
|
||||
-
|
||||
name: Get the version
|
||||
id: version
|
||||
run: echo ::set-output name=tag::${GITHUB_REF:10}
|
||||
-
|
||||
name: Generate change log
|
||||
run: scripts/changelog ${{ steps.version.outputs.tag }} > CHANGELOG.md
|
||||
-
|
||||
name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: "Release ${{ steps.version.outputs.tag }}"
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
@ -0,0 +1,18 @@
|
||||
name: Test on Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/Dockerfile.test
|
@ -1,25 +0,0 @@
|
||||
name: Run tests
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Run tests
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/Dockerfile.test
|
@ -1,36 +0,0 @@
|
||||
# Build steps need access to the Docker agent
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
# Run all the tests inside Docker
|
||||
|
||||
- stage: Test
|
||||
script: docker build -f Dockerfile.test .
|
||||
|
||||
|
||||
# If this is a tagged commit, publish the package to npm
|
||||
|
||||
- stage: Release npm
|
||||
script: echo "Deploying to npm"
|
||||
deploy:
|
||||
provider: npm
|
||||
email: asyncadventures@gmail.com
|
||||
api_key: $NPM_TOKEN
|
||||
on:
|
||||
tags: true
|
||||
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+
|
||||
|
||||
# If this is a tagged commit, publish a new Docker image
|
||||
|
||||
- stage: Release Docker
|
||||
script: echo "Deploying to DockerHub"
|
||||
deploy:
|
||||
provider: script
|
||||
script: scripts/travis-release-docker
|
||||
on:
|
||||
tags: true
|
||||
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [ -z "${TRAVIS_TAG}" ]; then
|
||||
echo "This script releases a Docker image corresponding to the npm package version"
|
||||
echo "It should only be run on Travis CI for tagged commits"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build the image
|
||||
|
||||
DOCKER_IMAGE="thumbsupgallery/thumbsup"
|
||||
PACKAGE_VERSION="${TRAVIS_TAG//v}"
|
||||
docker build -f Dockerfile.release -t "${DOCKER_IMAGE}:${PACKAGE_VERSION}" --build-arg "PACKAGE_VERSION=${PACKAGE_VERSION}" .
|
||||
|
||||
# Pushes both <thumbsup:x.y.z> and <thumbsup:latest>
|
||||
|
||||
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
|
||||
docker tag "${DOCKER_IMAGE}:${PACKAGE_VERSION}" "${DOCKER_IMAGE}:latest"
|
||||
docker push "${DOCKER_IMAGE}:${PACKAGE_VERSION}"
|
||||
docker push "${DOCKER_IMAGE}:latest"
|
Loading…
Reference in New Issue