Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

# Build and load checks. Everything that needs a credential runs elsewhere and reports
# back as a commit status, so no secret is reachable from this workflow.

on:
pull_request:
push:
branches: [master, main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: build (ruby ${{ matrix.ruby }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.3', '3.4']
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Load every file
run: bundle exec ruby -Ilib -e "require 'flat_api'; puts FlatApi::VERSION"
56 changes: 0 additions & 56 deletions .github/workflows/gem-push.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

# Publishing is triggered by a version tag and nothing else (FR-019a).

on:
push:
tags: ['[0-9]+.[0-9]+.[0-9]+']

permissions:
contents: read
id-token: write # OIDC for RubyGems trusted publishing (FR-021a)

jobs:
publish:
runs-on: ubuntu-latest
environment: rubygems
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true

- name: The tag must match the packaged version
run: |
TAG="${GITHUB_REF_NAME}"
PKG="$(ruby -Ilib -e "require 'flat_api/version'; print FlatApi::VERSION")"
[ "$TAG" = "$PKG" ] || { echo "tag $TAG != VERSION $PKG"; exit 1; }

- run: gem build flat_api.gemspec

# No API key: RubyGems trusts this repository and workflow by OIDC.
- uses: rubygems/release-gem@v1
36 changes: 0 additions & 36 deletions .github/workflows/ruby.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/tag-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tag on merge

# Merging is what creates the version tag, and the tag is what publishes (FR-007f, FR-019a).
# A breaking release waits for a human to merge, which is how the FR-019 approval is expressed.

on:
push:
branches: [master, main]

permissions:
contents: write

jobs:
tag:
runs-on: ubuntu-latest
steps:
# SDK_RELEASE_TOKEN, not the automatic GITHUB_TOKEN. GitHub does not start a workflow run for
# an event created with GITHUB_TOKEN, so a tag pushed with it would never trigger release.yml
# and nothing would ever publish. That failure is silent: the tag appears, the release
# workflow simply never runs. Needs contents:write on this repository.
# Checked before checkout. An empty token there surfaces as a bare "Input required and not
# supplied: token", which says nothing about which secret is missing or why it matters.
- name: SDK_RELEASE_TOKEN must be set
run: |
test -n "${{ secrets.SDK_RELEASE_TOKEN }}" || {
echo "SDK_RELEASE_TOKEN is not set on this repository."
echo
echo "The tag has to be pushed with it rather than the automatic GITHUB_TOKEN, because"
echo "GitHub does not start a workflow run for an event created with that token. The"
echo "tag would appear and release.yml would never fire, publishing nothing."
exit 1
}
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SDK_RELEASE_TOKEN }}
- name: Tag the version if it is new
run: |
VERSION="$(cat VERSION)"
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION already exists, nothing to do."
exit 0
fi
git config user.name "Flat SDK bot"
git config user.email "developers@flat.io"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ build/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# build artifacts
*.gem
.sdkgen-scratch/
.openapi-spec.yaml
.DS_Store
26 changes: 0 additions & 26 deletions .gitlab-ci.yml

This file was deleted.

Loading
Loading