mirror of
https://github.com/meshtastic/protobufs.git
synced 2026-04-20 22:13:55 +00:00
New CI workflow (#292)
* New CI workflow * fix for incorrect version handling * add normal CI workflow * only trigger on pushes to master
This commit is contained in:
parent
c93278c967
commit
629d1b559b
10 changed files with 132 additions and 149 deletions
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
|
|
@ -1,18 +1,27 @@
|
|||
name: pull-request
|
||||
on: pull_request
|
||||
name: Push commit to schema registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
push_to_registry:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: bufbuild/buf-setup-action@v1
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
- uses: bufbuild/buf-lint-action@v1
|
||||
- uses: bufbuild/buf-breaking-action@v1
|
||||
with:
|
||||
against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=master"
|
||||
- uses: bufbuild/buf-push-action@v1
|
||||
with:
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
draft: ${{ github.ref_name != 'master'}}
|
||||
|
||||
- name: Push to schema registry
|
||||
# uses: bufbuild/buf-push-action@v1
|
||||
# with:
|
||||
# buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
run: |
|
||||
export BUF_TOKEN=${{ secrets.BUF_TOKEN }}
|
||||
buf push --tag latest --tag ${{ github.sha }}
|
||||
|
|
|
|||
73
.github/workflows/create_release.yml
vendored
73
.github/workflows/create_release.yml
vendored
|
|
@ -1,73 +0,0 @@
|
|||
name: "CI"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout source
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: bufbuild/buf-setup-action@v1
|
||||
- uses: bufbuild/buf-lint-action@v1
|
||||
- uses: bufbuild/buf-breaking-action@v1
|
||||
with:
|
||||
against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=master"
|
||||
|
||||
release:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout source
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- name: Cache python libs
|
||||
uses: actions/cache@v3
|
||||
id: cache-pip # needed in if test
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip
|
||||
|
||||
- name: Upgrade python tools
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
- name: Get release version string
|
||||
run: echo "version=$(./scripts/buildinfo.py short)" >> $GITHUB_OUTPUT
|
||||
id: version
|
||||
|
||||
- name: Create release
|
||||
uses: actions/create-release@v1
|
||||
id: create_release
|
||||
with:
|
||||
release_name: Meshtastic Protobufs ${{ steps.version.outputs.version }}
|
||||
tag_name: v${{ steps.version.outputs.version }}
|
||||
body: Protobufs for version ${{ steps.version.outputs.version }} release of Meshtastic firmware
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Bump version.properties
|
||||
run: >-
|
||||
scripts/bump_version.py
|
||||
|
||||
- name: Create version.properties pull request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
add-paths: |
|
||||
version.properties
|
||||
59
.github/workflows/create_tag.yml
vendored
Normal file
59
.github/workflows/create_tag.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: Increment version and create tag
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
increment_type:
|
||||
type: choice
|
||||
description: "Select the type of version increment"
|
||||
required: true
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
jobs:
|
||||
increment_version:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get current version
|
||||
run: |
|
||||
VERSION=$(cat version | grep version: | awk '{print $2}')
|
||||
|
||||
- name: Increment version
|
||||
run: |
|
||||
# Split version into major, minor, and patch
|
||||
MAJOR=$(echo $VERSION | awk -F '.' '{print $1}' | cut -c 2-)
|
||||
MINOR=$(echo $VERSION | awk -F '.' '{print $2}')
|
||||
PATCH=$(echo $VERSION | awk -F '.' '{print $3}')
|
||||
|
||||
# Increment the appropriate part of the version
|
||||
if [[ ${{ inputs.increment_type }} == "patch" ]]; then
|
||||
PATCH=$((PATCH + 1))
|
||||
elif [[ ${{ inputs.increment_type }} == "minor" ]]; then
|
||||
MINOR=$((MINOR + 1))
|
||||
PATCH=0
|
||||
elif [[ ${{ inputs.increment_type }} == "major" ]]; then
|
||||
MAJOR=$((MAJOR + 1))
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
fi
|
||||
|
||||
# Update the version
|
||||
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
|
||||
sed -i "s/version: $VERSION/version: $NEW_VERSION/" version
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "Release $NEW_VERSION"
|
||||
push: true
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
git tag $NEW_VERSION
|
||||
git push origin $NEW_VERSION
|
||||
27
.github/workflows/publish.yml
vendored
Normal file
27
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Push new version to schema registry
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
|
||||
- name: Push to schema registry
|
||||
# uses: bufbuild/buf-push-action@v1
|
||||
# with:
|
||||
# buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
run: |
|
||||
export BUF_TOKEN=${{ secrets.BUF_TOKEN }}
|
||||
buf push --tag ${{ github.ref_name }}
|
||||
23
.github/workflows/pull_request.yml
vendored
Normal file
23
.github/workflows/pull_request.yml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
name: pull-request
|
||||
on: pull_request
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
|
||||
- name: Lint
|
||||
uses: bufbuild/buf-lint-action@v1
|
||||
|
||||
- name: Push to schema registry
|
||||
uses: bufbuild/buf-push-action@v1
|
||||
with:
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
draft: ${{ github.ref_name != 'master'}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue