Bump tar from 6.1.12 to 6.2.1 #342
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'CD' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
check: | |
name: Check Is Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Expose git commit information | |
uses: rlespinasse/git-commit-data-action@v1.x | |
- name: Parse data | |
id: parse | |
run: | | |
echo "is_release=${{ startsWith(env.GIT_COMMIT_MESSAGE_SUBJECT, 'Release ') }}" >> $GITHUB_OUTPUT | |
echo "version=$(echo ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }} | sed -r 's/Release //')" >> $GITHUB_OUTPUT | |
echo "tag=$(echo ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }} | sed -r 's/Release /v/')" >> $GITHUB_OUTPUT | |
outputs: | |
is_release: ${{ steps.parse.outputs.is_release }} | |
version: ${{ steps.parse.outputs.version }} | |
tag: ${{ steps.parse.outputs.tag }} | |
commit_message: ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }} | |
commit_body: ${{ env.GIT_COMMIT_MESSAGE_BODY }} | |
test-postgres: | |
name: Testing (Postgres) | |
needs: common-tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_DB: artgen | |
POSTGRES_USER: artgen | |
POSTGRES_PASSWORD: artgen | |
TZ: UTC | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install the interpreter | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: yarn | |
- name: Install development dependencies | |
run: yarn install --ignore-engines | |
- name: Run tests (PostgreSQL) | |
run: yarn test | |
env: | |
ARTGEN_DATABASE_DSN: postgres://artgen:artgen@localhost:5432/artgen | |
common-tests: | |
name: Common Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install the interpreter | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: yarn | |
- name: Install development dependencies | |
run: yarn install --ignore-engines | |
- name: Run type checking | |
run: yarn test:type | |
- name: Run tests (Common) | |
run: yarn test | |
env: | |
ARTGEN_DATABASE_DSN: "sqlite::memory:" | |
release-npm: | |
name: GPR / NPM release | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- test-postgres | |
if: ${{ success() && needs.check.outputs.is_release == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install the interpreter | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: yarn | |
- name: Install development dependencies | |
run: yarn install --ignore-engines | |
- name: Run build | |
run: yarn build | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
check-version: false | |
- name: Publish to GPR | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
check-version: false | |
registry: 'https://npm.pkg.github.com' | |
release-docker: | |
name: Docker release | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- test-postgres | |
if: ${{ success() && needs.check.outputs.is_release == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to the docker registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
# platforms: linux/amd64,linux/arm64 | |
tags: artgenio/core:latest,artgenio/core:${{ needs.check.outputs.version }} | |
release-gh: | |
name: GitHub release | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
- test-postgres | |
if: ${{ success() && needs.check.outputs.is_release == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create git tag | |
uses: negz/create-tag@v1 | |
with: | |
version: ${{ needs.check.outputs.tag }} | |
message: ${{ needs.check.outputs.commit_message }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GH release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ needs.check.outputs.version }} | |
body: | |
"**Automated release ${{ needs.check.outputs.commit_message }}** by GitHub Actions <3\n\n | |
${{ needs.check.outputs.commit_body }}\n | |
Docker install ```docker run -p 80:7200 artgenio/core:${{ needs.check.outputs.version }}``` | |
" | |
tag_name: ${{ needs.check.outputs.tag }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
url: ${{ steps.release.outputs.url }} | |
# # The demo is the latest released version | |
# deploy-demo: | |
# name: Deploy demo to Heroku | |
# runs-on: ubuntu-latest | |
# needs: | |
# - common-tests | |
# if: ${{ success() }} | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - uses: akhileshns/heroku-deploy@v3.12.12 | |
# with: | |
# heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | |
# heroku_app_name: ${{ secrets.HEROKU_APP_NAME }} | |
# heroku_email: ${{ secrets.HEROKU_EMAIL }} |