| # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created |
| # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path |
| name: Redis runner example |
| on: push |
| |
| jobs: |
| # Label of the runner job |
| runner-job: |
| # You must use a Linux environment when using service containers or container jobs |
| runs-on: ubuntu-latest |
| permissions: |
| contents: read |
| packages: write |
| |
| steps: |
| # Downloads a copy of the code in your repository before running CI tests |
| - name: Create RocketMQ container |
| run: | |
| docker pull apache/rocketmq:4.9.4 |
| docker run -d --name rmqnamesrv -p 9876:9876 apache/rocketmq:4.9.4 sh mqnamesrv autoCreateTopicEnable=true |
| docker run -d --name rmqbroker -p 10911:10911 -p 10909:10909 -e "NAMESRV_ADDR=127.0.0.1:9876" apache/rocketmq:4.9.4 sh mqbroker autoCreateTopicEnable=true |
| |
| - name: Wait for RocketMQ namesrv container to be ready |
| run: | |
| docker exec rmqnamesrv sh -c 'while ! nc -z localhost 9876; do sleep 1; done' |
| |
| - name: Wait for RocketMQ broker container to be ready |
| run: | |
| docker exec rmqbroker sh -c 'while ! nc -z localhost 10911; do sleep 1; done' |
| |
| - uses: actions/checkout@v3 |
| - name: Set up JDK 1.8 |
| uses: actions/setup-java@v3 |
| with: |
| java-version: '1.8' |
| distribution: 'temurin' |
| 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: Build with Maven |
| run: mvn -B package --file pom.xml |
| |
| - name: Publish to GitHub Packages Apache Maven |
| run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml |
| env: |
| GITHUB_TOKEN: ${{ github.token }} |