maven.yml 1.1 KB

123456789101112131415161718192021222324252627
  1. name: Auto Deploy Docker
  2. on:
  3. push:
  4. branches: [ "master","2.0" ]
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - uses: actions/checkout@v2
  10. - name: Set up JDK 1.8
  11. uses: actions/setup-java@v1
  12. with:
  13. java-version: 1.8
  14. - name: Cache Maven Repository
  15. uses: actions/cache@v3
  16. with:
  17. path: ~/.m2
  18. key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
  19. - name: Build with Maven
  20. run: ./mvnw clean install -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")" -Dmaven.test.skip=true -Pbuild && cd jetlinks-standalone && docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) .
  21. - name: Login Docker Repo
  22. run: echo "${{ secrets.ALIYUN_DOCKER_REPO_PWD }}" | docker login registry.cn-shenzhen.aliyuncs.com -u ${{ secrets.ALIYUN_DOCKER_REPO_USERNAME }} --password-stdin
  23. - name: Push Docker
  24. run: docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)