-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes from https://github.com/profcomff/issue-github-tgbot
- Loading branch information
Showing
7 changed files
with
217 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Build, publish and deploy docker | ||
|
||
on: | ||
push: | ||
branches: [ 'main' ] | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
name: Build and push | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@master | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
type=raw,value=test,enable=true | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
deploy-production: | ||
name: Deploy Production | ||
needs: build-and-push-image | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
runs-on: [ self-hosted, Linux ] | ||
environment: | ||
name: Production | ||
env: | ||
CONTAINER_NAME: ${{ vars.DOCKER_CONTAINER_NAME }} | ||
permissions: | ||
packages: read | ||
steps: | ||
- name: Pull new version | ||
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
- name: Run new version | ||
run: | | ||
docker stop ${{ env.CONTAINER_NAME }} || true && docker rm ${{ env.CONTAINER_NAME }} || true | ||
docker run \ | ||
--detach \ | ||
--restart always \ | ||
--env BOT_TOKEN='${{ secrets.BOT_TOKEN }}' \ | ||
--env BOT_NICKNAME='${{ secrets.BOT_NICKNAME }}' \ | ||
--env GH_ACCOUNT_TOKEN='${{ secrets.GH_ACCOUNT_TOKEN }}' \ | ||
--env GH_ORGANIZATION_NICKNAME='${{ vars.GH_ORGANIZATION_NICKNAME }}' \ | ||
--env GH_SCRUM_STATE='${{ vars.GH_SCRUM_STATE }}' \ | ||
--env GH_SCRUM_ID='${{ vars.GH_SCRUM_ID }}' \ | ||
--env GH_SCRUM_FIELD_ID='${{ vars.GH_SCRUM_FIELD_ID }}' \ | ||
--env GH_SCRUM_FIELD_DEFAULT_STATE='${{ vars.GH_SCRUM_FIELD_DEFAULT_STATE }}' \ | ||
--name ${{ env.CONTAINER_NAME }} \ | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
mutation CreateIssue ($repositoryId: ID!, $title: String!, $body: String!) { | ||
createIssue( | ||
input: { | ||
repositoryId: $repositoryId, | ||
title: $title, | ||
body: $body | ||
} | ||
) { | ||
issue { | ||
number | ||
body | ||
url | ||
id | ||
} | ||
} | ||
} | ||
|
||
mutation CreateIssueScrum ($repositoryId: ID!, $title: String!, $body: String!, $projectIds: [ID!]) { | ||
createIssue( | ||
input: { | ||
repositoryId: $repositoryId, | ||
title: $title, | ||
body: $body, | ||
projectIds: $projectIds | ||
} | ||
) { | ||
issue { | ||
number | ||
body | ||
url | ||
id | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters