File: deploy.yml

package info (click to toggle)
python-txaio 25.6.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 576 kB
  • sloc: python: 2,477; makefile: 226; sh: 48
file content (60 lines) | stat: -rw-r--r-- 2,222 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: deploy

on:
  # Trigger this workflow when the "main" workflow has completed successfully
  # https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_run
  workflow_run:
    workflows:
      - main
    branches:
      - master
    types:
      - completed

jobs:

  deploy:
    if: github.ref == 'refs/heads/master'

    # https://github.blog/changelog/2020-12-15-github-actions-environments-environment-protection-rules-and-environment-secrets-beta/
    # https://docs.github.com/en/free-pro-team@latest/actions/reference/environments
    environment: deploy_aws

    env:
      AWS_DEFAULT_REGION:    ${{ secrets.AWS_DEFAULT_REGION }}
      AWS_S3_BUCKET_NAME:    ${{ secrets.AWS_S3_BUCKET_NAME }}
      AWS_ACCESS_KEY_ID:     ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      WAMP_PRIVATE_KEY:      ${{ secrets.WAMP_PRIVATE_KEY }}

    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2

    # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
    # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
    - name: Set environment
      run: |
        echo BUILD_DATE=`date -u +"%Y-%m-%d"` >> $GITHUB_ENV
        echo TXAIO_VCS_REF=`git rev-parse --short ${GITHUB_SHA}` >> $GITHUB_ENV
        echo TXAIO_BUILD_ID=$(date --utc +%Y%m%d)-$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV
        echo TXAIO_VERSION=$(grep -E '^(__version__)' ./txaio/_version.py | cut -d ' ' -f3 | sed -e 's|[u"'\'']||g') >> $GITHUB_ENV

    # - name: Set environment - 2
    #   run: |
    #     echo TXAIO_VCS_REF=`git --git-dir="./.git" rev-list -n 1 v${TXAIO_VERSION} --abbrev-commit` >> $GITHUB_ENV

    - name: Set up Python 3.x
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
        architecture: 'x64'

    - name: Install Python package dependencies
      run: |
        python -m pip install --upgrade pip
        pip install .[dev]

    - name: Deploy (build, package and upload)
      run: |
        ./deploy.sh