Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Configure GitHub Actions #3

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions build.sh → .build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ function create_changelogs_if_not_present() {
create_changelog_if_not_present ${version_code} "en-US"
create_changelog_if_not_present ${version_code} "nl-NL"
local changelog_path="fastlane/metadata/android/*/changelogs"
# travis_add_and_commit "$changelog_path" "chore: Added default changelogs for version code ${version_code}."
# travis_push "$TRAVIS_BRANCH"
}

function get_version_code_from_gradle() {
Expand All @@ -35,11 +33,10 @@ function get_version_number_from_gradle() {
function tag_git_with_version_number() {
local version_number="$1"

if [[ "$version_number" != "" ]]; then
if [[ -n "$version_number" ]]; then
echo "Tagging version $version_number"
git tag -a "$version_number" -m"Version $version_number [ci skip]"
# travis_push $TRAVIS_BRANCH
travis_push "$version_number"
git push "$version_number"
else
>&2 echo "Version number not tagged!"
fi
Expand All @@ -50,12 +47,24 @@ set -ex
basedir=$(dirname $0)
source $basedir/build-helpers.sh

# travis_checkout_branch
version_code=$(get_version_code_from_gradle)
version_number=$(get_version_number_from_gradle)

# Create changelogs
create_changelogs_if_not_present ${version_code}

# Decrypt and unpack secrets
gpg --quiet --batch --yes --decrypt --passphrase="$SECRETS_FILE_PASSPHRASE" \
--output secrets.tar secrets.tar.gpg
tar xvf secrets.tar

# Create release
./gradlew clean bundleRelease
if [[ "${TRAVIS_BRANCH}" == "master" ]]; then
bundle exec fastlane deploy version_code:${version_code}
tag_git_with_version_number ${version_number}
fi

# Upload to Google Play
# TODO
# bundle exec fastlane deploy version_code:${version_code}

# Create a Git tag
# TODO
# tag_git_with_version_number ${version_number}
File renamed without changes.
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Main
on: [push]
jobs:
compile-test-package:
name: Compile, test, package
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: "1.8"
- name: Compile, test and package
run: ./gradlew clean compile test bundleRelease
release:
name: Release
runs-on: ubuntu-20.04
needs: compile-test-package
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true
- name: Create a release
run: .build/release.sh
env:
SECRETS_FILE_PASSPHRASE: ${{ secrets.SECRETS_FILE_PASSPHRASE }}
File renamed without changes.
31 changes: 30 additions & 1 deletion dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# Documentation

## Signing and Deploying
TODO: See
https://www.raywenderlich.com/19407406-continuous-delivery-for-android-using-github-actions
TODO: Search for "TODO" in the entire repository
TODO: Delete secrets.tar.enc


## Signing and Deploying (GitHub Actions)

<-- Reference: https://docs.github.com/en/actions/reference/encrypted-secrets#limits-for-secrets -->

1. Create the signing key:
```sh
keytool -genkey -v -keystore scheleaap.jks -alias wmsnotes -keyalg RSA -keysize 2048 -validity 10000
```
1. Create a file containing all secrets:
```sh
tar cvf secrets.tar scheleaap.jks keystore.properties google-services.json
travis login --com
travis encrypt-file --com --add secrets.tar
```
1. Encrypt the secrets file:
```sh
gpg --symmetric --cipher-algo AES256 secrets.tar
```
You will be asked to enter a passphrase.
1. [Create a repository secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) named `SECRETS_FILE_PASSPHRASE` containing the passphrase.


## Singing and Deploying (Travis CI)


The Travis CLI was installed as follows (on Ubuntu 16.04):
```sh
Expand Down