chore: Add release-please [fixed FLU-208 and FLU-225] (#89)

* Add release-please

* Fix adding labels to image

* Update labels

* Fix
This commit is contained in:
Anatolios Laskaris 2023-01-24 17:29:11 +02:00 committed by GitHub
parent 22e80ba606
commit a2bd116596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 152 additions and 96 deletions

View File

@ -1,5 +0,0 @@
{
"template": "${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
"pr_template": "- ${{TITLE}}",
"empty_template": "- no changes"
}

12
.github/release-please/config.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"bootstrap-sha": "2e9429016356cb6599aa13da13f3a1f37c92c59a",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"package-name": "distro",
"component": "distro"
}
}
}

3
.github/release-please/manifest.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
".": "0.0.74"
}

35
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: lint
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint actions
uses: reviewdog/action-actionlint@v1
env:
SHELLCHECK_OPTS: "-e SC2086 -e SC2207 -e SC2128"
with:
reporter: github-pr-check
fail_on_error: true

View File

@ -1,42 +1,45 @@
name: "release"
name: "release-please"
on:
push:
tags:
- "v*"
branches:
- "main"
env:
RUN_NUMBER: ${{ github.run_number }}
DOCKER_BUILDKIT: 1
FORCE_COLOR: 1
jobs:
prepare:
name: "Prepare"
release-please:
runs-on: ubuntu-latest
outputs:
build_date: "${{ steps.build_date.outputs.date }}"
release_version: "${{ steps.release_version.outputs.version }}"
release-created: ${{ steps.release.outputs['release_created'] }}
tag-name: ${{ steps.release.outputs['tag_name'] }}
version: ${{ steps.release.outputs['version'] }}
pr: ${{ steps.release.outputs['pr'] }}
steps:
- name: Set build date
id: build_date
run: echo "::set-output name=date::$(date '+%Y-%m-%dT%H:%M:%S%:z')"
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Set release version
id: release_version
run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/*/})"
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
build:
name: Build and push ${{ matrix.package }}
publish:
if: needs.release-please.outputs.release-created
name: "Build and push ${{ matrix.package }}"
runs-on: ubuntu-latest
needs: prepare
env:
BUILD_DATE: ${{ needs.prepare.outputs.build_date }}
RELEASE_VERSION: ${{ needs.prepare.outputs.release_version }}
needs: release-please
strategy:
matrix:
@ -51,7 +54,13 @@ jobs:
contents: read
id-token: write
env:
RELEASE_VERSION: ${{ needs.release-please.outputs.version }}
steps:
- name: Set build date
run: echo "BUILD_DATE=$(date '+%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
@ -88,11 +97,11 @@ jobs:
fluencelabs/rust-peer:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
fluencelabs/fluence:${{ matrix.package }}
fluencelabs/fluence:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
build-args: |
COMMIT=${{ github.sha }}
BUILD_DATE=${{ env.BUILD_DATE }}
RUN_NUMBER=${{ env.RUN_NUMBER }}
TAG=${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.ref.name=${{ needs.release-please.outputs.tag-name }}
cache-from: type=gha
cache-to: type=gha,mode=max
@ -108,11 +117,11 @@ jobs:
fluencelabs/rust-peer:${{ env.RELEASE_VERSION }}
fluencelabs/fluence:latest
fluencelabs/fluence:${{ env.RELEASE_VERSION }}
build-args: |
COMMIT=${{ github.sha }}
BUILD_DATE=${{ env.BUILD_DATE }}
RUN_NUMBER=${{ env.RUN_NUMBER }}
TAG=${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.ref.name=${{ needs.release-please.outputs.tag-name }}
cache-from: type=gha
cache-to: type=gha,mode=max
@ -124,37 +133,24 @@ jobs:
password: ${{ env.DOCKER_PASSWORD }}
repository: fluencelabs/rust-peer
release:
name: "Release"
update-release:
name: "Update release"
runs-on: ubuntu-latest
needs:
- prepare
- build
- release-please
- publish
env:
RELEASE_VERSION: ${{ needs.prepare.outputs.release_version }}
RELEASE_VERSION: ${{ needs.release-please.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: ".github/misc/changelog_config.json"
commitMode: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Fluence Node ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.RELEASE_VERSION }}
tag_name: ${{ needs.release-please.outputs.tag-name }}
append_body: true
body: |
${{ steps.github_release.outputs.changelog }}
## Docker tags
@ -178,7 +174,50 @@ jobs:
fluencelabs/rust-peer:rich
fluencelabs/rust-peer:rich_${{ env.RELEASE_VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
slack:
if: always()
name: "Notify"
runs-on: ubuntu-latest
needs:
- release-please
- publish
- update-release
permissions:
contents: read
id-token: write
steps:
- uses: lwhiteley/dependent-jobs-result-check@v1
id: status
with:
statuses: failure
dependencies: ${{ toJSON(needs) }}
- name: Log output
run: |
echo "statuses:" "${{ steps.status.outputs.statuses }}"
echo "jobs:" "${{ steps.status.outputs.jobs }}"
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
- uses: ravsamhq/notify-slack-action@v2
if: steps.status.outputs.found == 'true'
with:
status: "failure"
notification_title: "*{workflow}* has {status_message}"
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
footer: "<{run_url}>"

View File

@ -1,17 +0,0 @@
name: "tag"
on:
workflow_dispatch:
jobs:
tag:
name: "Tag"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.5
with:
github_token: ${{ secrets.PERSONAL_TOKEN }}

View File

@ -39,6 +39,6 @@ jobs:
uses: EndBug/add-and-commit@v7
with:
add: 'fluence/fluence.json'
message: 'Update Fluence to ${{ github.event.inputs.version }}'
message: 'fix(deps): Update Fluence to ${{ github.event.inputs.version }}'
push: true
pull_strategy: 'NO-PULL'

View File

@ -50,6 +50,6 @@ jobs:
uses: EndBug/add-and-commit@v7
with:
add: 'fluence/services.json'
message: 'Update ${{ github.event.inputs.name }} to ${{ github.event.inputs.version }}'
message: 'fix(deps): Update ${{ github.event.inputs.name }} to ${{ github.event.inputs.version }}'
push: true
pull_strategy: 'NO-PULL'

View File

@ -1,9 +1,3 @@
ARG COMMIT
ARG SERVICES_VERSION
ARG RUN_NUMBER
ARG TAG
ARG BUILD_DATE
ARG IPFS_VERSION=0.13.1
ARG CERAMIC_VERSION=2.3.x
ARG GLAZED_VERSION=0.2.x
@ -31,18 +25,13 @@ RUN tar -xzf "bitcoin-${BITCOIN_CLI_VERSION}-x86_64-linux-gnu.tar.gz"
FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy as minimal
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
LABEL org.opencontainers.image.created="${BUILD_DATE}"
LABEL org.opencontainers.image.revision="${COMMIT}"
LABEL org.opencontainers.image.ref.name="${COMMIT}"
LABEL org.opencontainers.image.base.name="ghcr.io/linuxserver/baseimage-ubuntu:focal"
LABEL org.opencontainers.image.url="https://github.com/fluencelabs/node-distro"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.url="https://github.com/fluencelabs/rust-peer-distro"
LABEL org.opencontainers.image.vendor="fluencelabs"
LABEL maintainer="fluencelabs"
LABEL org.opencontainers.image.authors="fluencelabs"
LABEL org.opencontainers.image.title="Fluence Node"
LABEL org.opencontainers.image.description="Minimal image containing only Fluence Node itself"
LABEL dev.fluence.image.builtins="${SERVICES_VERSION}"
LABEL org.opencontainers.image.title="Fluence rust-peer distro"
LABEL org.opencontainers.image.description="Minimal image containing only rust-peer itself"
ENV RUST_LOG="info,aquamarine=warn,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,cranelift_codegen=info,wasmer_wasi=info"
ENV RUST_BACKTRACE="1"
@ -92,7 +81,7 @@ COPY s6/minimal/ /
# ----------------------------------------------------------------------------
FROM minimal as ipfs
LABEL org.opencontainers.image.description="Fluence Node bundled with IPFS daemon"
LABEL org.opencontainers.image.description="rust-peer bundled with IPFS daemon"
LABEL dev.fluence.bundles.ipfs="${IPFS_VERSION}"
ENV IPFS_PATH=/config/ipfs
@ -126,7 +115,7 @@ ARG GLAZED_VERSION
ARG GETH_VERSION
ARG BITCOIN_CLI_VERSION
LABEL org.opencontainers.image.description="Fluence Node bundled with IPFS, Ceramic CLI and other tools"
LABEL org.opencontainers.image.description="rust-peer bundled with IPFS, Ceramic CLI and other tools"
LABEL dev.fluence.image.bundles.ceramic="${CERAMIC_VERSION}"
LABEL dev.fluence.image.bundles.glazed="${GLAZED_VERSION}"
LABEL dev.fluence.image.bundles.bitcoin_cli="${BITCOIN_CLI_VERSION}"