Skip to content

Generate Latest API Version #95

Generate Latest API Version

Generate Latest API Version #95

Workflow file for this run

name: Generate Latest API Version
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get API Version
id: version
run: |
API_VERSION="$(date +'%Y-%m')"
echo "API_VERSION=$API_VERSION" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: true
- name: Install Ruby
uses: ruby/setup-ruby@v1
- name: Install JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Install Bundler
run: |
gem install bundler
BUNDLE_GEMFILE="MobileBuy/buy3/Gemfile" bundle install --verbose
- name: Build new SDK version
working-directory: MobileBuy/buy3
run: |
echo "Generating schema for $API_VERSION"
./update_schema.rb "$API_VERSION"
- name: Create and reset release branch
run: git checkout -B "$API_VERSION-auto-generated" # -B will reset branch if it exists
- name: Stage and push generated files
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Update schema (auto-generated)"
git push --set-upstream --force origin "$API_VERSION-auto-generated"
- uses: actions/github-script@0.9.0
with:
script: |
const today = new Date();
const yyyy = today.getFullYear();
const mm = String(today.getMonth() + 1).padStart(2, '0');
const api_version = yyyy + '-' + mm
github.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Update Schema to `" + api_version + "` Release",
head: api_version + '-auto-generated',
base: 'main',
body: "Release notes:" +
"\n- https://shopify.dev/api/release-notes/" + api_version + "#graphql-storefront-api-changes" +
"\n" +
"\n**Steps to release:**" +
"\n- [ ] Make sure tests are passing" +
"\n- [ ] Set the SDK version number in [`gradle.properties`](https://github.com/Shopify/mobile-buy-sdk-android/blob/" + api_version + "-auto-generated/MobileBuy/buy3/gradle.properties#L1)" +
"\n- [ ] Update the [Buy SDK and Library Releases spreadsheet](https://docs.google.com/spreadsheets/d/1WZ8dEl9dQQ6O3ZmBpvq3x-25pBUzN7J6fyj6GnVdS0Q) with the new SDK version" +
"\n- [ ] After merging this PR, remember to update the automatically created [draft release](https://github.com/Shopify/mobile-buy-sdk-android/releases) with the same version number"
})