chore: cleanup Github workflows and replace Travis CI

pull/231/head
Romain 3 years ago
parent 0218f90f38
commit 421f1eef2a

@ -1,4 +1,4 @@
name: Publish base Docker images
name: Publish Docker base images
on:
workflow_dispatch:
@ -10,24 +10,15 @@ jobs:
matrix:
nodejs: [10, 12, 14]
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: Login to GitHub Container Registry
uses: docker/login-action@v1
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
-
name: Publish thumbsup/runtime
- name: Publish thumbsup/runtime
uses: docker/build-push-action@v2
with:
context: docker
@ -36,8 +27,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ghcr.io/thumbsup/runtime:node-${{ matrix.nodejs }}
push: true
-
name: Publish thumbsup/build
- name: Publish thumbsup/build
uses: docker/build-push-action@v2
with:
context: docker

@ -2,33 +2,27 @@ name: Publish Docker image
on:
workflow_dispatch:
workflow_run:
workflows: ["Publish NPM package"]
types:
- completed
jobs:
publish:
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: Login to GitHub Container Registry
uses: docker/login-action@v1
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
-
id: version
- id: version
name: Fetch latest NPM version
run: echo ::set-output name=version::$(npm show thumbsup version)
-
name: Publish Docker image
- name: Publish Docker image
uses: docker/build-push-action@v2
with:
context: docker

@ -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,10 +1,9 @@
name: Test on Windows
on:
on:
workflow_dispatch:
jobs:
test:
name: Test on Windows
runs-on: windows-latest

@ -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…
Cancel
Save