Skip to content

Commit

Permalink
feat(release): Auto release (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
bagelbits authored Apr 1, 2022
1 parent 4323471 commit 9fe7952
Show file tree
Hide file tree
Showing 5 changed files with 18,835 additions and 1,678 deletions.
64 changes: 62 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: 5e SRD API CI
name: 5e SRD API CI/CD

on:
push:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: npm run test:integration:local
heroku:
deploy:
name: Trigger Heroku Deploy
runs-on: ubuntu-latest
needs: [unit, integration, lint]
Expand All @@ -55,3 +55,63 @@ jobs:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "dnd-5e-srd-api"
heroku_email: "[email protected]"
github-release:
name: Github Release
runs-on: ubuntu-latest
needs: [deploy]
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
container-release:
name: Container Release
runs-on: ubuntu-latest
needs: [deploy, github-release]
if: github.event_name != 'pull_request'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 0 additions & 42 deletions .github/workflows/release.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
],
"branches": ["main"]
}
Loading

0 comments on commit 9fe7952

Please sign in to comment.