Skip to content

Commit

Permalink
feat: Init
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Oct 29, 2021
0 parents commit 1170545
Show file tree
Hide file tree
Showing 7 changed files with 11,115 additions and 0 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/release-docker-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Release
on:
workflow_call:
secrets:
token:
required: true
inputs:
docker_image:
required: true
type: string

jobs:
docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Checkout Current
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ inputs.docker_image }}
tags: |
type=ref,event=branch
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.token }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha

version:
name: Semantic release
needs: docker
runs-on: ubuntu-latest
outputs:
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
extra_plugins: |
https://gitpkg.now.sh/stenic/.github/semantic-release/docker-helm?main
extends: |
@stenic/semantic-release-docker-helm-config
env:
GITHUB_TOKEN: ${{ secrets.token }}

docker_release:
name: Docker release
needs: version
if: ${{ needs.version.outputs.new_release_published == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Current
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
${{ inputs.docker_image }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{version}},value=${{ needs.version.outputs.new_release_version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.version.outputs.new_release_version }}
type=semver,pattern={{major}},value=${{ needs.version.outputs.new_release_version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.token }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Shareable workflows

## Docker-Helm

Steps:

- Build docker image (multi-arch)
- Use semantic-release to find version
- Update helm chart version
- Generate CHANGELOG.md
- Publish helm chart
- Publish Docker images

```yaml
name: Release
on:
push:
branches:
- 'main'

jobs:
release:
name: Release
uses: stenic/github-workflows/.github/workflows/release-docker-helm.yaml@main
with:
docker_image: "ghcr.io/${{ github.repository }}"
secrets:
token: ${{ secrets.GH_TOKEN }}
```
20 changes: 20 additions & 0 deletions semantic-release/docker-helm/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": [
["@semantic-release/commit-analyzer"],
["@semantic-release/release-notes-generator"],
["@semantic-release/changelog", {
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
}],
["semantic-release-helm", {
"chartPath": "./charts/test",
"crPublish": true,
"crConfigPath": "./.github/ct.yaml"
}],
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "charts/**"],
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
}],
["@semantic-release/github"]
],
"branches": ["master", "main"]
}
18 changes: 18 additions & 0 deletions semantic-release/docker-helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# @stenic/semantic-release-docker-helm-config

[**semantic-release**](https://github.com/semantic-release/semantic-release) shareable config to publish npm packages with [GitHub](https://github.com).

## Plugins

This [shareable configuration](https://github.com/stenic/semantic-release-docker-helm-config/blob/master/.releaserc.json) uses the following plugins:

- [`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer)
- [`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator)
- [`@semantic-release/changelog`](https://github.com/semantic-release/changelog)
- [`@semantic-release/git`](https://github.com/semantic-release/git)
- [`@semantic-release/github`](https://github.com/semantic-release/github)
- [`semantic-release-helm`](https://github.com/m1pl/semantic-release-helm)


## Github action

Loading

0 comments on commit 1170545

Please sign in to comment.