Skip to content

Commit

Permalink
Merge pull request #2 from primer-io/nq/github_actions
Browse files Browse the repository at this point in the history
ci: adds github actions for release
  • Loading branch information
NQuinn27 authored Aug 2, 2024
2 parents 5af50a5 + 04ac764 commit 441b241
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .cz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tool.commitizen]
version_scheme = "semver"
version = "0.0.1"
version_files = [
"PrimerStripeSDK/Sources/Version/Version.swift:let PrimerStripeSDKVersion",
"PrimerStripeSDK.podspec:spec.version",
]
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* @primer-io/acceptance-mobile-ios

.github/CODEOWNERS @primer-io/checkout-pci-reviewers
.github/workflows @primer-io/checkout-pci-reviewers

/fastlane @primer-io/checkout-pci-reviewers

PrimerStripeSDK.podspec @primer-io/checkout-pci-reviewers
/PrimerStripeSDK/Sources/Version/Version.swift @primer-io/checkout-pci-reviewers
54 changes: 54 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Create Release

on:
workflow_dispatch:
inputs:
releaseType:
description: "Release Type"
required: true
type: choice
options:
- default
- alpha
- beta
- rc

jobs:
bump-version:
runs-on: ubuntu-latest
name: "Bump release version and create changelog"
steps:
- name: Check out repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_ACCESS_TOKEN }}
- name: Install cz
run: pip install --user -U Commitizen
- name: Record from version
run: |
echo "FROM_VERSION=$(cz version --project)" >> $GITHUB_ENV
- name: Create release branch
run: |
git checkout -b release/next
git push -u origin release/next
# Bump version and create CHANGELOG - default release
- name: Create bump and changelog
if: ${{ inputs.releaseType == 'default' }}
run: cz bump --files-only --yes --changelog
# Bump version and create CHANGELOG - prereleasee
- name: Create bump and changelog
if: ${{ inputs.releaseType != 'default' }}
run: cz bump --files-only --yes --changelog --prerelease ${{ inputs.releaseType }}
- name: Record to version
run: |
echo "TO_VERSION=$(cz version --project)" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e #v6.0.5
with:
token: ${{ secrets.RELEASE_ACCESS_TOKEN }}
base: main
branch: release/next
delete-branch: true
title: Release ${{ env.TO_VERSION }}
body: "Bumped ${{ env.FROM_VERSION}} -> ${{ env.TO_VERSION }}"
36 changes: 36 additions & 0 deletions .github/workflows/pod-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run lint and static analysis

on:
pull_request:
types:
- opened
- synchronize

jobs:
pod-lint:
if: ${{ github.event.pull_request.base.ref == 'main' }}
runs-on: macos-latest
name: "Pod lint"
strategy:
fail-fast: false
matrix:
version: ["5"]

steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ruby/setup-ruby@943103cae7d3f1bb1e4951d5fcc7928b40e4b742 # v1.177.1
with:
ruby-version: "3.2"
bundler-cache: true

- name: Lint pod
run: |
set -eo pipefail
pod lib lint --allow-warnings --swift-version=${{ matrix.version }} --analyze
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/post-release-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Post Release PR Merge

on:
pull_request:
types: [closed]

jobs:
release_merge:
if: github.head_ref == 'release/next' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Git - Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.RELEASE_ACCESS_TOKEN }}
fetch-depth: 0
- name: Install cz
run: pip install --user -U Commitizen
- name: Record previous version
run: |
echo "FROM_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Record release version
run: |
echo "RELEASE_VERSION=$(cz version --project)" >> $GITHUB_ENV
- name: Tag release
run: |
git tag $RELEASE_VERSION
git push origin $RELEASE_VERSION
- name: Record changelog for current release
run: cz changelog $FROM_VERSION..$RELEASE_VERSION --file-name="release.md"
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 #v1.14.0
with:
name: "Release ${{ env.RELEASE_VERSION }}"
tag: ${{ env.RELEASE_VERSION }}
bodyFile: "release.md"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ fastlane/screenshots
# Other
.idea/
*.hmap
*.xcscmblueprint
*.xcscmblueprint

# Sensitive files
*.pem
*.crt
15 changes: 15 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variables:
RUBY_VERSION: 3.2.2

workflow:
rules:
- if: $CI_COMMIT_TAG

build-and-release:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ruby:$RUBY_VERSION
script:
- bundle install
- pod trunk push --allow-root
when: manual
environment: production
125 changes: 125 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Contributing to Primer Stripe SDK

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Reporting issues

A bug 🐛 is something nobody ever wants. Though they happen 🤷‍♂️.

Please read the following guidelines before you [report an issue](https://github.com/primer-io/primer-stripe-sdk-ios/issues):

1. **Use the GitHub issue search** — check if the issue has already been
reported. If it has been, please comment on the existing issue.

2. **Check if the issue has been fixed** — the latest `master` or
development branch may already contain a fix.

3. **Isolate the problem** — make sure that the code in the
project's repository is responsible for the issue. Create a broken-down list of steps or an
extremely simple and immediately viewable example of the issue.

4. **Include a live example** — provide a link, screenshot, video
or anything that could help us understand better the domain.

Please try to be as detailed as possible in your report too. What is your
environment? What steps will reproduce the issue? What browser(s) and OS
experience the problem? What would you expect to be the outcome? All these
details will help people to assess and fix any potential bugs.

### Example of a good bug report:

> Short and descriptive title
>
> A summary of the issue
> All info that could help us isolate the scenario, such as:
> - MacOS Version
> - Xcode Version
> - Primer Stripe SDK version
> - OS Version (either real device or Simulator)
> - language
> - Network coverage (WiFi, Data Network)
> - Diagnostic ID in case you get one out of the any Error thrown by the SDK
>
> Include the steps required to reproduce the bug.
> 1. This is the first step
> 2. This is the second step
> 3. Further steps, etc.
>
>
> Any other information you want to share that is relevant to the issue being
> reported. This might include the lines of code that you have identified as
> causing the bug, and potential solutions (and your opinions on their
> merits).
A good bug report shouldn't leave people needing to chase you up to get further
information that is required to assess or fix the bug.

**[File a bug report](https://github.com/primer-io/primer-stripe-sdk-ios/issues)**

## Pull requests

Good pull requests — patches, improvements, new features — are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.

If your contribution involves a significant amount of work or substantial
changes to any part of the project, please open an issue to discuss it first.

Please follow this process; it's the best way to get your work included in the
project:

1. [Fork](http://help.github.com/fork-a-repo/) the project.

2. Clone your fork (`git clone
https://github.com/<your-username>/mobile-boilerplate.git`).

3. Add an `upstream` remote (`git remote add upstream
https://github.com/h5bp/mobile-boilerplate.git`).

4. Get the latest changes from upstream (e.g. `git pull upstream
<dev-branch>`).

5. Create a new topic branch to contain your feature, change, or fix (`git
checkout -b <topic-branch-name>`).

6. Make sure that your changes adhere to the current coding conventions used
throughout the project - indentation, accurate comments, etc. Please update
any documentation that is relevant to the change you are making.

7. Commit your changes in logical chunks; use git's [interactive
rebase](https://help.github.com/articles/interactive-rebase) feature to tidy
up your commits before making them public. Please adhere to these [git commit
message
guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your pull request is unlikely be merged into the main project.

8. Locally merge (or rebase) the upstream branch into your topic branch.

9. Push your topic branch up to your fork (`git push origin
<topic-branch-name>`).

10. [Open a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) with a
clear title and description. Our direct Primer Stripe SDK PR section [link](https://github.com/primer-io/primer-stripe-sdk-ios)

### Thanks 🙏
#### You are helping us making our product better 👌, faster 🚀, stronger 💪
2 changes: 1 addition & 1 deletion PrimerStripeSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Pod::Spec.new do |spec|
spec.name = 'PrimerStripeSDK'
spec.version = '0.0.1'
spec.swift_version = '5.0'
spec.swift_version = '5'
spec.summary = 'A wrapper around the Stripe SDK for Primer.'
spec.homepage = 'https://github.com/primer-io/primer-stripe-sdk-ios'
spec.license = { :type => 'MIT', :file => __dir__ + '/LICENSE' }
Expand Down
2 changes: 1 addition & 1 deletion PrimerStripeSDK/Sources/Version/Version.swift
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
let PrimerStripeSDKVersion = "1.0.0"
let PrimerStripeSDKVersion = "0.0.1"
let StripeSDKVersion = "23.27.0" // Stripe syncs their version across all sub dependencies

0 comments on commit 441b241

Please sign in to comment.