mirror of https://github.com/miaowware/qrm2.git
add/update workflows [WIP]
- remove docker hub from image push - add workflow to create releases when tags are pushed - add workflow job to run mypy on push
This commit is contained in:
parent
7e35e8949a
commit
88bd987212
|
@ -20,6 +20,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build image
|
||||
id: build_image
|
||||
run: |
|
||||
echo ${{ github.sha }} > git_commit
|
||||
docker build . --file Dockerfile -t $IMAGE_NAME
|
||||
|
@ -27,13 +28,10 @@ jobs:
|
|||
- name: Log into Github Package Registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
||||
|
||||
- name: Log into Docker Hub
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Push image to registries
|
||||
id: push_image
|
||||
run: |
|
||||
GITHUB_IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
|
||||
DOCKER_IMAGE_ID=${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME
|
||||
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
|
||||
|
||||
# Strip git ref prefix from version
|
||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||
|
@ -43,16 +41,31 @@ jobs:
|
|||
|
||||
[[ "$VERSION" == "master" ]] && VERSION=dev
|
||||
|
||||
echo GITHUB_IMAGE_ID=$GITHUB_IMAGE_ID
|
||||
echo DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID
|
||||
echo IMAGE_ID=$IMAGE_ID
|
||||
echo VERSION=$VERSION
|
||||
|
||||
# tag for Github Registry
|
||||
docker tag $IMAGE_NAME $GITHUB_IMAGE_ID:$VERSION
|
||||
[[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $GITHUB_IMAGE_ID:latest
|
||||
docker push $GITHUB_IMAGE_ID
|
||||
# allow $IMAGE_ID and $VERSION to be used in future steps
|
||||
echo ::set-output name=image_id::${IMAGE_ID}
|
||||
echo ::set-output name=version::${VERSION}
|
||||
|
||||
# tag for Docker Hub
|
||||
docker tag $IMAGE_NAME $DOCKER_IMAGE_ID:$VERSION
|
||||
[[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $DOCKER_IMAGE_ID:latest
|
||||
docker push $DOCKER_IMAGE_ID
|
||||
# tag for Github Registry
|
||||
# tag dev or x.x.x
|
||||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
||||
# tag latest if not a dev release
|
||||
[[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest
|
||||
docker push $IMAGE_ID
|
||||
|
||||
- name: Deploy Official Images
|
||||
id: deploy_images
|
||||
uses: satak/webrequest-action@v1.2.3
|
||||
with:
|
||||
url: ${{ secrets.DEPLOY_URL }}
|
||||
method: POST
|
||||
headers: '{"Authentication": "Token ${{ secrets.DEPLOY_TOKEN }}"}'
|
||||
payload: |
|
||||
# repository is $namespace/$repo
|
||||
# version is dev or x.x.x
|
||||
'{
|
||||
"repository": "${{ github.repository }}",
|
||||
"version": "${{ steps.push_image.outputs.version }}"
|
||||
}'
|
||||
|
|
|
@ -19,3 +19,16 @@ jobs:
|
|||
checkName: 'flake8_py3' # NOTE: this needs to be the same as the job name
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
mypy_py3:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
architecture: x64
|
||||
- name: Install mypy
|
||||
# install dev-requirements.txt?
|
||||
run: pip install mypy
|
||||
- name: Run mypy
|
||||
run: mypy # --idk-what-args
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
name: Create Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get Version Info
|
||||
id: get_tag
|
||||
shell: bash
|
||||
run: |
|
||||
SUBJECT=$(/usr/bin/git tag -l ${GITHUB_REF#refs/tags/} --format='%(subject)')
|
||||
echo SUBJECT=$SUBJECT
|
||||
BODY=$(/usr/bin/git tag -l ${GITHUB_REF#refs/tags/} --format='%(body)' | sed '/-----BEGIN PGP SIGNATURE-----/,$d')
|
||||
echo BODY=$BODY
|
||||
|
||||
echo ::set-output name=subject::${SUBJECT}
|
||||
echo ::set-output name=body::${BODY}
|
||||
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
|
||||
|
||||
- name: Get Changelog Content
|
||||
id: changelog_reader
|
||||
uses: mindsers/changelog-reader-action@v2
|
||||
with:
|
||||
version: ${{ steps.get_tag.outputs.current_version }}
|
||||
path: ./CHANGELOG.md
|
||||
|
||||
- name: Publish Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.changelog_reader.outputs.version }}
|
||||
release_name: ${{ steps.get_tag.outputs.subject }}
|
||||
body: |
|
||||
${{ steps.get_tag.outputs.body }}
|
||||
|
||||
## Changelog
|
||||
|
||||
${{ steps.changelog_reader.outputs.changes }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
Loading…
Reference in New Issue