GitHub Actions makes it easy to build, test, and deploy your code right from GitHub. However, etting up fastlane to work with match on GitHub Actions can take bit of juggling and manual work 😔
But fastlane-plugin-github_action
to the rescue 💪
This plugin will:
Running fastlane on a CI requires the environment to be setup properly. Calling the setup_ci action does that by configuring a new keychain that will be used for code signing with match
A Deploy Key is needed for GitHub Actions to access your match repository. This action creates a new SSH key and uses the public key for the Deploy Key on your match repository.
This will only get executed if the match_org
and match_repo
options are specified.
3. Set the Deploy Key private key in secrets (along with secrets in your dotenv file(s)
The private key created for the Deploy Key is store encrypted in your repository secrets. The private key is stored under the name MATCH_DEPLOY_KEY
.
Encrypted secrets will also get set for environment variables from dotenv files specified by the dotenv_paths
option.
A Workflow YAML file is created at .github/workflows/fastlane.yml
. This will enable your repository to start running GitHub Actions right away - once committed and pushed 😉. The Workflow YAML template will add the Deploy Key private key into the GitHub Action by loading it from the MATCH_DEPLOY_KEY
secret and executing ssh-add
. All of your other encrypted secrets will also be loaded into environment variables for you as well.
An example can be seen here.
This project is a fastlane plugin. To get started with fastlane-plugin-github_action
, add it to your project by running:
fastlane add_plugin github_action
fastlane-plugin-github_action
depends on rbnacl which uses libsodium
For macOS, libsodium can be installed with:
brew install libsodium
See https://github.com/RubyCrypto/rbnacl/wiki/Installing-libsodium for more installation instructions.
fastlane-plugin-github_action
can be execute either direction on the command line with bundle exec fastlane run github_action
or by adding github_action
to your Fastfile
.
bundle exec fastlane run github_action \
api_token:"your-github-personal-access-token-with-all-repo-permissions" \
org:"your-org" \
repo:"your-repo"
or
bundle exec fastlane run github_action \
api_token:"your-github-personal-access-token-with-all-repo-permissions" \
org:"your-org" \
repo:"your-repo" \
match_org:"your-match-repo-org" \
match_repo:"your-match-repo" \
dotenv_paths:"fastlane/.env.secret,fastlane/.env.secret2"
lane :init_ci do
github_action(
api_token: "your-github-personal-access-token-with-all-repo-permissions",
org: "your-org",
repo: "your-repo",
match_org: "your-match-repo-org", # optional
match_repo: "your-match-repo", # optional
dotenv_paths: ["fastlane/.env.secret", "fastlane/.env.secret2"] # optional
)
end
Once installed, information and help for an action can be printed out with this command:
fastlane action github_action # or any action included with this plugin
Key | Environment Variable | Description |
---|---|---|
server_url |
FL_GITHUB_API_SERVER_URL |
The server url. e.g. 'https://your.internal.github.host/api/v3' (Default: 'https://api.github.com') |
api_token |
FL_GITHUB_API_TOKEN |
Personal API Token for GitHub - generate one at https://github.com/settings/tokens |
org |
FL_GITHUB_ACTIONS_ORG |
Name of organization of the repository for GitHub Actions |
repo |
FL_GITHUB_ACTIONS_REPO |
Name of repository for GitHub Actions |
match_org |
FL_GITHUB_ACTIONS_MATCH_ORG |
Name of organization of the match repository |
match_repo |
FL_GITHUB_ACTIONS_MATCH_REPO |
Name of match repository |
dotenv_paths |
FL_GITHUB_ACTINOS_DOTENV_PATHS |
Paths of .env files to parse |
Check out the example Fastfile
to see how to use this plugin. Try it by cloning the repo, running fastlane install_plugins
and bundle exec fastlane test
.
To run both the tests, and code style validation, run
rake
To automatically fix many of the styling issues, use
rubocop -a
For any other issues and feedback about this plugin, please submit it to this repository.
If you have trouble using plugins, check out the Plugins Troubleshooting guide.
For more information about how the fastlane
plugin system works, check out the Plugins documentation.
fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.