name: Release on: push: tags: - "v*" jobs: docker: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Setup poetry uses: Gr1N/setup-poetry@v4 - name: Setup Docker uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Login to Github Container Registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Get Version id: version run: | echo "::set-output name=VERSION::$(poetry version -s)" echo "::set-output name=TAG::${GITHUB_REF#refs/tags/v}" - name: Check Version if: ${{ steps.version.outputs.VERSION != steps.version.outputs.TAG }} run: exit 1 - name: Generate Tags uses: docker/metadata-action@v3 id: metadata with: images: | cscs181/qq-github-bot ghcr.io/cscs181/qq-github-bot tags: | type=semver,pattern={{version}} type=sha - name: Build and Publish uses: docker/build-push-action@v2 with: context: . push: true tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }}