|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + tag: |
| 6 | + description: "Tag name, e.g. 0.7.11" |
| 7 | + default: "" |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Upload Release Asset |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Login to Quay.io |
| 21 | + uses: docker/login-action@v2 |
| 22 | + with: |
| 23 | + registry: ${{ vars.IMAGE_REGISTRY }} |
| 24 | + username: ${{ secrets.docker_username }} |
| 25 | + password: ${{ secrets.docker_password }} |
| 26 | + |
| 27 | + - name: Git set user |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + git config user.name "$USERNAME" |
| 31 | + git config user.email "[email protected]" |
| 32 | + env: |
| 33 | + USERNAME: ${{ github.actor }} |
| 34 | + |
| 35 | + - name: Update the VERSION |
| 36 | + run: | |
| 37 | + echo "$VERSION" > VERSION |
| 38 | + env: |
| 39 | + VERSION: ${{ github.event.inputs.tag }} |
| 40 | + |
| 41 | + - name: Build model-server-base |
| 42 | + run: | |
| 43 | + make build-base |
| 44 | + env: |
| 45 | + IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }} |
| 46 | + |
| 47 | + - name: Push model-server-base |
| 48 | + run: | |
| 49 | + make push-base |
| 50 | + env: |
| 51 | + IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }} |
| 52 | + |
| 53 | + - name: Update base in model-server dockerfile |
| 54 | + run: | |
| 55 | + sed -i "s/model_server_base:.*/model_server_base:v$VERSION/g" ./dockerfiles/Dockerfile |
| 56 | + env: |
| 57 | + VERSION: ${{ github.event.inputs.tag }} |
| 58 | + |
| 59 | + - name: Build model-server |
| 60 | + run: | |
| 61 | + make build |
| 62 | + env: |
| 63 | + IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }} |
| 64 | + |
| 65 | + - name: Create tag |
| 66 | + run: | |
| 67 | + git add VERSION ./dockerfiles/Dockerfile |
| 68 | + git commit -m "ci: update VERSION to $VERSION" |
| 69 | + git tag -a "v$VERSION" -m "$VERSION" |
| 70 | + git show --stat |
| 71 | + env: |
| 72 | + VERSION: ${{ github.event.inputs.tag }} |
| 73 | + |
| 74 | + - name: Push Images |
| 75 | + run: | |
| 76 | + make push |
| 77 | + env: |
| 78 | + IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }} |
| 79 | + |
| 80 | + - name: Push Release tag |
| 81 | + run: | |
| 82 | + git push --follow-tags |
| 83 | +
|
| 84 | + - name: Create Release |
| 85 | + id: create_release |
| 86 | + uses: actions/create-release@v1 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + with: |
| 90 | + tag_name: "v${{ github.event.inputs.tag }}" |
| 91 | + release_name: "v${{ github.event.inputs.tag }}-release" |
| 92 | + draft: false |
| 93 | + prerelease: false |
| 94 | + |
| 95 | + create-release-branch: |
| 96 | + name: Create Release Branch |
| 97 | + permissions: |
| 98 | + contents: write |
| 99 | + needs: build |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Create release branch |
| 103 | + uses: peterjgrainger/[email protected] |
| 104 | + env: |
| 105 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + with: |
| 107 | + branch: "v${{ github.event.inputs.tag }}-release" |
| 108 | + sha: "${{ github.event.pull_request.head.sha }}" |
0 commit comments