@@ -104,6 +104,12 @@ jobs:
104104 - name: 🐦 Setup Shorebird
105105 uses: shorebirdtech/setup-shorebird@v1
106106
107+ - name: Set up Java
108+ uses: actions/setup-java@v4
109+ with:
110+ distribution: 'temurin'
111+ java-version: '17'
112+
107113 - name: 🚀 Shorebird Release
108114 uses: shorebirdtech/shorebird-release@v0
109115 with:
@@ -152,6 +158,12 @@ jobs:
152158 - name: 🐦 Setup Shorebird
153159 uses: shorebirdtech/setup-shorebird@v1
154160
161+ - name: Set up Java
162+ uses: actions/setup-java@v4
163+ with:
164+ distribution: 'temurin'
165+ java-version: '17'
166+
155167 # Note: all signing information (key.properties, etc.) must be set up on
156168 # this runner for ` shorebird patch android` to work.
157169 - name : 🚀 Shorebird Patch
@@ -176,184 +188,4 @@ The `shorebird-patch` action also outputs the patch number:
176188
177189:: :
178190
179- # # Fully Automated Workflow Example
180-
181- A fully automated workflow between your project repository and the CI service can allow developers
182- to trigger deploys of your application just by pushing to the project repository,
183- streamlining the development workflow, which can reduce the chance of error due to
184- repetitive, manual tasks.
185-
186- There are several ways of setting this up, and in many instances, how it is set up will depending
187- on how the git workflow of your project is structured, or which CI service is used, among other
188- factors.
189-
190- This guide is a simple proposal for setting up a Fully automated workflow using GitHub Actions. It
191- is intentionally simple so that it can be easily adapted to different requirements and contexts.
192-
193- # ## Goal
194-
195- We will be implementing an automation in a project that have the following goals :
196-
197- - Any branches created off from `main` that starts with the prefix `release/` will trigger a
198- release at Shorebird.
199- - Any additional commits on those branches will trigger patches.
200-
201- # ## Prerequisites
202-
203- Before anything, if you don't have a Shorebird account, be sure to create one at
204- [shorebird.dev](https://shorebird.dev) (Don't worry, it is free to start have a generous quota
205- that is way more than enough for this guide).
206-
207- You will also need a GitHub account and a project repository created. If you don't have an account
208- yet, create one at [GitHub](https://github.com), and create a new repository, which for this guide
209- we will call `shorebird_automated_workflow`.
210-
211- # ## Getting Started
212-
213- First thing, lets create a new Flutter project simply by running :
214-
215- ` ` ` sh
216- flutter create shorebird_automated_workflow
217- ` ` `
218-
219- Be sure to initialize your project as a git repository :
220-
221- ` ` ` sh
222- cd shorebird_automated_workflow
223- git init
224- git remote add origin <THE_URL_OF_YOUR_REPOSITORY>
225- ` ` `
226-
227- Next we need to initialize shorebird in it! Check out the [Code Push Getting Started](/code-push/initialize/) guide for more info.
228-
229- # # Setting up GitHub Actions
230-
231- We provide a collection of official GitHub Actions to help you with the integration. For this guide
232- we will be using `shorebird-setup`, `shorebird-release` and `shorebird-patch`, you can learn more
233- about them at the beginning of this page.
234-
235- Create a new file at `.github/workflows/shorebird_android.yml` with the following content :
236-
237- ` ` ` yaml
238- name: Shorebird Android
239-
240- on:
241- push:
242- branches:
243- - releases/*
244-
245- env:
246- SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
247-
248- jobs:
249- shorebird_android:
250- defaults:
251- run:
252- shell: bash
253-
254- runs-on: ubuntu-latest
255-
256- steps:
257- - name: 📚 Git Checkout
258- uses: actions/checkout@v3
259-
260- - name: 🐦 Setup Shorebird
261- uses: shorebirdtech/setup-shorebird@v1
262-
263- - name: 🚀 Shorebird Release
264- if: ${{ github.event.created }}
265- uses: shorebirdtech/shorebird-release@v0
266- with:
267- platform: android
268-
269- - name: 🚀 Shorebird Patch
270- if: ${{ !github.event.created }}
271- uses: shorebirdtech/shorebird-patch@v0
272- with:
273- platform: android
274- ` ` `
275-
276- Let's take a closer look at the above workflow.
277- The workflow will be triggered whenever a push is made to a branch that starts with `releases/`.
278-
279- It will then run the clone of the repository and setup the Shorebird CLI.
280-
281- Next the workflow is divided into two conditional steps. If the push is the one that created the
282- branch, it will trigger a release. Otherwise it will trigger a patch.
283-
284- :::note
285- The `SHOREBIRD_TOKEN` is used as an environment variable. This is a secret that
286- should be stored in your repository settings. If you have not already configured the secrets, check out the
287- [GitHub Integration Documentation](/ci/github) mentioned above.
288- :: :
289-
290- That's it! You should be able to push the changes to your repository and see the workflow
291- running in the actions tab of your repository.
292-
293- Give it a try! Create a new branch called `releases/1.0.0` and push it to your repository :
294-
295- ` ` ` sh
296- git checkout -b releases/1.0.0
297- git push origin releases/1.0.0
298- ` ` `
299-
300- That will trigger the action! Once the workflow finishes, check the [Shorebird console](https://console.shorebird.dev)
301- and you should see a new release for your app.
302-
303- Next lets make the following change in our app :
304-
305- ` ` ` diff
306- class MyApp extends StatelessWidget {
307- const MyApp({super.key});
308-
309- // This widget is the root of your application.
310- @override
311- Widget build(BuildContext context) {
312- return MaterialApp(
313- title: 'Flutter Demo',
314- theme: ThemeData(
315- // This is the theme of your application.
316- //
317- // Try running your application with "flutter run". You'll see the
318- // application has a blue toolbar. Then, without quitting the app, try
319- // changing the primarySwatch below to Colors.green and then invoke
320- // "hot reload" (press "r" in the console where you ran "flutter run",
321- // or simply save your changes to "hot reload" in a Flutter IDE).
322- // Notice that the counter didn't reset back to zero; the application
323- // is not restarted.
324- - primarySwatch: Colors.blue,
325- + primarySwatch: Colors.green,
326- ),
327- home: const MyHomePage(title: 'Flutter Demo Home Page'),
328- );
329- }
330- }
331- ` ` `
332-
333- And commit and push it!
334-
335- ` ` ` sh
336- git add .
337- git commit -m "Change primarySwatch to green"
338- git push origin releases/1.0.0
339- ` ` `
340-
341- That will trigger the action again, but now a patch will be created 🎉.
342-
343- # ## Summary
344-
345- As mentioned, the workflow presented here is just one way of setting up a fully automated workflow.
346- Feel free to adapt it based on your teams needs and existing processes.
347-
348- Some ways the workflow can be expanded are :
349-
350- - Instead of directly committing to the branch after the release was made. Developers would land their
351- changes and fixes on their main branch, and then `cherry-pick` it to the release branch!
352- - Both `shorebird-release` and `shorebird-patch` returns the version/patch-number created. The workflow
353- could be expanded in order for tags to be created in the repository, using the version number returned
354- allowing snapshots of the code to be easily identified.
355-
356- See this workflow in action by checking out our [Time Shift App](https://github.com/shorebirdtech/time_shift).
357-
358- Thank you for reading this guide! If you have any questions or suggestions, feel free to reach out
359- to us at our [Discord](https://discord.gg/shorebird).
191+ For an example of a fully automated development workflow, see our [Development Workflow Guide](/guides/development-workflow).
0 commit comments