name: Build Image on: push: tags: - v* jobs: build: if: github.event.base_ref == 'refs/heads/master' runs-on: ubuntu-latest name: Build image job steps: - name: Checkout master uses: actions/checkout@v3 - name: Get version id: get_version if: startsWith(github.ref, 'refs/tags/') && startsWith(github.repository, 'Binaryify/NeteaseCloudMusicApi') run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build and publish image uses: elgohr/Publish-Docker-Github-Action@v5 if: startsWith(github.ref, 'refs/tags/') && startsWith(github.repository, 'Binaryify/NeteaseCloudMusicApi') with: name: binaryify/netease_cloud_music_api # dockerid/imageName platforms: linux/arm64,linux/amd64 # 你准备构建的镜像平台 tags: latest,${{ steps.get_version.outputs.VERSION }} username: ${{ secrets.DOCKER_USERNAME }} # docker hub userid 在setting创建secrets name=DOCKER_USERNAME value=dockerid password: ${{ secrets.DOCKER_PASSWORD }} # docker hub password,在setting创建secrets name=DOCKER_PASSWORD value=dockerpassword