Skip to content

Commit

Permalink
Merge pull request #51 from koterpillar/semantic-release
Browse files Browse the repository at this point in the history
Semantic release
  • Loading branch information
koterpillar authored Mar 15, 2024
2 parents cb01290 + 0b06b60 commit 356dec8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 45 deletions.
68 changes: 23 additions & 45 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
name: Build

name: CI
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
- 'main'
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * 5"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install system dependencies
run: sudo ./install-deps
- name: Set up Stack
run: stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
uses: freckle/stack-action@v5
- name: Set up cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: stack
path: ~/.stack
Expand All @@ -34,41 +27,26 @@ jobs:
run: |
stack --no-terminal test
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
publish:
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Stack
run: stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
- name: Set up cache
uses: actions/cache@v3
with:
key: stack
path: ~/.stack
- name: Build
run: |
stack --no-terminal build --copy-bins --local-bin-path .
- name: Log in to the Container registry
uses: docker/login-action@v2
uses: actions/checkout@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate Docker tag
id: tag
uses: frabert/[email protected]
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
pattern: '^refs/tags/'
string: ${{ github.ref }}
replace-with: ''
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/koterpillar/multiblog:${{ steps.tag.outputs.replaced }},
ghcr.io/koterpillar/multiblog:latest
node-version: 20
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx \
--package @codedependant/semantic-release-docker@4 \
--package semantic-release@18 \
semantic-release
17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@codedependant/semantic-release-docker",
{
"dockerRegistry": "ghcr.io",
"dockerProject": "koterpillar",
"dockerImage": "multiblog",
"dockerTags": ["latest", "{{version}}"]
}
],
"@semantic-release/github"
]
}

0 comments on commit 356dec8

Please sign in to comment.