ci: add auto release (#1632)

This commit is contained in:
Manuel 2021-11-21 23:34:47 +01:00 committed by GitHub
parent e09104ee36
commit 922e5bf6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 4953 additions and 46 deletions

View File

@ -3,7 +3,7 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: [ '**' ]
env:
CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer'
CI_XCODE_13: '/Applications/Xcode_13.1.app/Contents/Developer'
@ -34,7 +34,6 @@ jobs:
- name: Send codecov
run: bash <(curl https://codecov.io/bash)
macos:
runs-on: macos-latest
steps:
@ -152,7 +151,7 @@ jobs:
env:
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
release:
assets:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

View File

@ -1,28 +1,23 @@
name: release
name: release-automated
on:
release:
types: [published]
push:
branches: [ master, release, alpha, beta ]
env:
CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer'
CI_XCODE_13: '/Applications/Xcode_13.0.app/Contents/Developer'
jobs:
cocoapods:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: CocoaPods
run: set -o pipefail && env NSUnbufferedIO=YES pod lib lint --allow-warnings --verbose
- name: Deploy CocoaPods
run: set -o pipefail && env NSUnbufferedIO=YES pod trunk push Parse.podspec --allow-warnings --verbose
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
docs:
runs-on: macos-11
release:
runs-on: ubuntu-latest
outputs:
current_tag: ${{ steps.tag.outputs.current_tag }}
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Cache Gems
id: cache-gems
uses: actions/cache@v2
@ -31,25 +26,47 @@ jobs:
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Install Bundle
- name: Submodules and Bundle Install
run: |
bundle config path vendor/bundle
git submodule update --init --recursive
sudo gem install bundler
bundle config set path 'vendor/bundle'
bundle install
- name: Create Jazzy Docs
run: |
./Scripts/jazzy.sh
- run: npm ci
- run: npx semantic-release
env:
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
- name: Deploy Jazzy Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tag on current commit
id: tag
run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')"
release:
cocoapods:
needs: release
if: needs.release.outputs.current_tag != ''
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.current_tag }}
- name: CocoaPods
run: set -o pipefail && env NSUnbufferedIO=YES pod lib lint --allow-warnings --verbose
- name: Deploy CocoaPods
run: set -o pipefail && env NSUnbufferedIO=YES pod trunk push Parse.podspec --allow-warnings --verbose
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
assets:
needs: release
if: needs.release.outputs.current_tag != ''
runs-on: macos-11
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.current_tag }}
- name: Cache Gems
id: cache-gems
uses: actions/cache@v2
@ -73,6 +90,38 @@ jobs:
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/release/*
tag: ${{ github.ref }}
tag: ${{ needs.release.outputs.current_tag }}
overwrite: true
file_glob: true
publish-docs:
needs: release
if: needs.release.outputs.current_tag != ''
runs-on: macos-11
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.current_tag }}
- name: Cache Gems
id: cache-gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Install Bundle
run: |
bundle config path vendor/bundle
bundle install
- name: Create Jazzy Docs
run: |
./Scripts/jazzy.sh
env:
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
- name: Deploy Jazzy Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs

11
.gitignore vendored
View File

@ -38,3 +38,14 @@ docs/
.idea/
ParseFacebookUtils/Vendor
ParseUI/Vendor
# VSC
.project
# Node
node_modules/
npm-debug.log
# Ruby
.bundle
Vendor/

61
.releaserc/commit.hbs Normal file
View File

@ -0,0 +1,61 @@
*{{#if scope}} **{{scope}}:**
{{~/if}} {{#if subject}}
{{~subject}}
{{~else}}
{{~header}}
{{~/if}}
{{~!-- commit link --}} {{#if @root.linkReferences~}}
([{{shortHash}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.commit}}/{{hash}}))
{{~else}}
{{~shortHash}}
{{~/if}}
{{~!-- commit references --}}
{{~#if references~}}
, closes
{{~#each references}} {{#if @root.linkReferences~}}
[
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if this.repository}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}
{{~else}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~/if}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.issue}}/{{this.issue}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}
{{~/if}}{{/each}}
{{~/if}}

11
.releaserc/footer.hbs Normal file
View File

@ -0,0 +1,11 @@
{{#if noteGroups}}
{{#each noteGroups}}
### {{title}}
{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}} ([{{commit.shortHash}}]({{commit.shortHash}}))
{{/each}}
{{/each}}
{{/if}}

25
.releaserc/header.hbs Normal file
View File

@ -0,0 +1,25 @@
{{#if isPatch~}}
##
{{~else~}}
#
{{~/if}} {{#if @root.linkCompare~}}
[{{version}}](
{{~#if @root.repository~}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if~}}
/compare/{{previousTag}}...{{currentTag}})
{{~else}}
{{~version}}
{{~/if}}
{{~#if title}} "{{title}}"
{{~/if}}
{{~#if date}} ({{date}})
{{/if}}

14
.releaserc/template.hbs Normal file
View File

@ -0,0 +1,14 @@
{{> header}}
{{#each commitGroups}}
{{#if title}}
### {{title}}
{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
{{/each}}
{{> footer}}

View File

@ -1,10 +1,4 @@
# Parse-SDK-iOS-OSX Changelog
### master
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.2...master)
* _Contributing to this repo? Add info about your change here to be included in next release_
### 1.19.2
# 1.19.2
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.1...1.19.2)
__Improvements__
@ -13,7 +7,7 @@ __Improvements__
__Fixes__
- Crash in Twitter login flow ([#1566](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1567)), thanks to [dhana](https://github.com/dsp1589).
### 1.19.1
# 1.19.1
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.0...1.19.1)
__Improvements__
@ -24,7 +18,7 @@ __Fixes__
- Bolts compilation error in Xcode 12 ([#1548](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1548)), thanks to [Derek Lee](https://github.com/derekleerock).
- App Store submission failed for MinimumOSVersion ([#1515](https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1515)), thanks to [Manuel Trezza](https://github.com/mtrezza).
### 1.19.0
# 1.19.0
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.18.0...1.19.0)
__New features__
@ -38,8 +32,7 @@ __Fixes__
- Removes deprecated UIWebView usage ([#1511](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1511)), thanks to [Nathan Kellert](https://github.com/parse-community/Parse-SDK-iOS-OSX/commits?author=noobs2ninjas).
- Fixes building with Xcode 12 ([#1527](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1527)), thanks to [Steffen Matthischke](https://github.com/HeEAaD).
### 1.18.0
# 1.18.0
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.17.3...1.18.0)
__New features__
@ -66,7 +59,7 @@ __Fixes__
After getting in contact with the Bolts Framework maintainers from Facebook they have allowed us to get changes in to fix app store declines due to still using UIWebView(iOS only) rather than updating to WKWebView(iOS, macOS, and iPad OS compatible). Those that got declined should be able to re-submit after updating to the latest version of this SDK as well as its dependencies.
### 1.17.3
# 1.17.3
[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.17.2...1.17.3)
__New Features__

4609
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "parse-sdk-ios-osx",
"version": "1.19.2",
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/parse-community/Parse-SDK-iOS-OSX.git"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.0",
"@semantic-release/commit-analyzer": "9.0.1",
"@semantic-release/exec": "6.0.2",
"@semantic-release/git": "10.0.0",
"@semantic-release/release-notes-generator": "10.0.2",
"semantic-release": "18.0.0"
}
}

118
release.config.js Normal file
View File

@ -0,0 +1,118 @@
/**
* Semantic Release Config
*/
const fs = require('fs').promises;
const path = require('path');
// Get env vars
const ref = process.env.GITHUB_REF;
const serverUrl = process.env.GITHUB_SERVER_URL;
const repository = process.env.GITHUB_REPOSITORY;
const repositoryUrl = serverUrl + '/' + repository;
// Declare params
const resourcePath = './.releaserc/';
const templates = {
main: { file: 'template.hbs', text: undefined },
header: { file: 'header.hbs', text: undefined },
commit: { file: 'commit.hbs', text: undefined },
footer: { file: 'footer.hbs', text: undefined },
};
// Declare semantic config
async function config() {
// Get branch
const branch = ref.split('/').pop();
console.log(`Running on branch: ${branch}`);
// Set changelog file
//const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
const changelogFile = `./CHANGELOG.md`;
console.log(`Changelog file output to: ${changelogFile}`);
// Load template file contents
await loadTemplates();
const config = {
branches: [
'master',
// { name: 'alpha', prerelease: true },
// { name: 'beta', prerelease: true },
// 'next-major',
// Long-Term-Support branches
// { name: 'release-1', range: '1.x.x', channel: '1.x' },
// { name: 'release-2', range: '2.x.x', channel: '2.x' },
// { name: 'release-3', range: '3.x.x', channel: '3.x' },
// { name: 'release-4', range: '4.x.x', channel: '4.x' },
],
dryRun: false,
debug: true,
ci: true,
tagFormat: '${version}',
plugins: [
['@semantic-release/commit-analyzer', {
preset: 'angular',
releaseRules: [
{ type: 'docs', scope: 'README', release: 'patch' },
{ scope: 'no-release', release: false },
],
parserOpts: {
noteKeywords: [ 'BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING' ],
},
}],
['@semantic-release/release-notes-generator', {
preset: 'angular',
parserOpts: {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING']
},
writerOpts: {
commitsSort: ['subject', 'scope'],
mainTemplate: templates.main.text,
headerPartial: templates.header.text,
commitPartial: templates.commit.text,
footerPartial: templates.footer.text,
},
}],
['@semantic-release/changelog', {
'changelogFile': changelogFile,
}],
["@semantic-release/exec", {
"prepareCmd": "bundle exec rake package:set_version\[${nextRelease.version}\]"
}],
['@semantic-release/npm', {
'npmPublish': false,
}],
['@semantic-release/git', {
assets: [changelogFile, 'package.json', 'package-lock.json', 'Parse.podspec', ['Parse*/**/*.{h,plist}', '!**/xcuserdata/**'] ],
}],
['@semantic-release/github', {
successComment: getReleaseComment(),
labels: ['type:ci'],
releasedLabels: ['state:released<%= nextRelease.channel ? `-\${nextRelease.channel}` : "" %>']
}],
],
};
return config;
}
async function loadTemplates() {
for (const template of Object.keys(templates)) {
const text = await readFile(path.resolve(__dirname, resourcePath, templates[template].file));
templates[template].text = text;
}
}
async function readFile(filePath) {
return await fs.readFile(filePath, 'utf-8');
}
function getReleaseComment() {
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}';
let comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')';
return comment;
}
module.exports = config();