Skip to content

Commit

Permalink
chore: add github release workflow (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Pete Gautier <pete@momentohq.com>
  • Loading branch information
pgautier404 and pgautier404 authored Oct 24, 2022
1 parent fc57a6b commit baa460c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/manual-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Manual Release
# Triggers a merge from main->release, which will then trigger a release
# from the release branch.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
merge-to-release-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- name: Merge main -> release
uses: devmasx/merge-branch@master
with:
type: now
from_branch: main
target_branch: release
github_token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/on-push-to-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: On push to release

on:
push:
branches: [ release ]

jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v3
- name: Set release
id: semrel
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true
# For whatever reason, this silly tool won't let you do releases from branches
# other than the default branch unless you pass this flag, which doesn't seem
# to actually have anything to do with CI:
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44
custom-arguments: "--no-ci"

- name: Output release
id: release
run: echo "::set-output name=release::${{ steps.semrel.outputs.version }}"

test:
runs-on: ubuntu-latest
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: php-integration-test-cache

steps:
- uses: actions/checkout@v3

- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v1
with:
project_status: official
project_stability: alpha
project_type: sdk
sdk_language: PHP
usage_example_path: ./examples/example.php

- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
env:
GITHUB_TOKEN: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: grpc
tools: composer

- name: Install dependencies
run: composer install

- name: Run tests
run: php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml

0 comments on commit baa460c

Please sign in to comment.