Use GitHub actions to continuously publish the shuttle app


Use GitHub actions to continuously publish the shuttle app


Github ActionsIt is a CI / CD service provided by GitHub. If your fluent application code is placed on GitHub, you can use this service to automate application testing, construction and release.

First, let’s talk about some core concepts of GitHub actions. I feel it’s very easy to understand. I have to say that the design of GitHub actions is very powerful

Workflow file

The configuration workflow file, in yaml format, is placed in the root directory of the project.github/workflowsIn the directory


A workflow defined by a configuration file, consisting of a series of tasks


A task in a workflow consists of a series of step steps


An execution step of a task, executing some commands or actions


For specific operations to be performed in a step, such as pulling code, sending request, etc., you can use your own or community shared action


Events that trigger workflow operation, such as pushing code to the warehouse, creating a version tag, etc


What happens when the engineering process is executed


This is where the workflow runs, the server provided by GitHub


The following is an example project to illustrate how to use GitHub actions to publish the fluent application and put the results firstaddress

Use GitHub actions to continuously publish the shuttle app

First create a fluent project

flutter create flutter_github_actions

Add a profile.github/workflows/main.yml

Use GitHub actions to continuously publish the shuttle app

Configure the workflow and push the code to GitHub

# main.yml

#Name of Workflow
name: Test, Build and Release apk

#The workflow is triggered when a version tag is pushed to the warehouse
      - v*

#Tasks to be performed by this workflow
    name: all process
    runs-on: ubuntu-latest
    #The steps of this task
      #Pull item code
      - uses: actions/[email protected]
      #Establish Java environment
      - name: Setup Java JDK
        uses: actions/[email protected]
          java-version: "12.x"
      #Establish a flutter environment
      - name: Flutter action
        uses: subosito/[email protected]
          channel: "stable"
          flutter-version: "1.12.x"
      #Download project dependencies
      - run: flutter pub get
      #Perform test
      - run: flutter test
      #Pack apk
      - run: flutter build apk --release
      #Release to release
      - name: Release apk
        uses: ncipollo/[email protected]
          artifacts: "build/app/outputs/apk/release/*.apk"
          token: ${{ secrets.GITHUB_RElEASE_TOKEN }}

Create token

To release the constructed APK to the release of the warehouse, you also need to create aPersonal access tokenProvide permission to publish action, access and operate the code warehouse. Be careful not to close the browser tag, because this token is only visible when it is created for the first time.

Use GitHub actions to continuously publish the shuttle app

Add environment variable

Finally, in order to create a token in the workflow, you need to add an environment variable in the secrets of the warehouseGITHUB_RElEASE_TOKENTo store the token value

Use GitHub actions to continuously publish the shuttle app

Trigger build

Finally, create a version label and push it to the warehouse to trigger the workflow

git tag v1.0.0

git push --tag

Then you can see the running workflow in the actions of the warehouse

Use GitHub actions to continuously publish the shuttle app


To sum up, there are the following four steps

  1. Create a workflow profile.github/workflows/main.yml
  2. Create a personal access token
  3. Add an environment variable to the serect of the projectGITHUB_RElEASE_TOKEN
  4. Push a version label # to trigger the workflow

Then it can be published automatically after each label is published

Original address

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]