publish.yaml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ---
  2. name: Publish Version
  3. on:
  4. release:
  5. types: [created, edited]
  6. jobs:
  7. publish:
  8. name: Publish Version
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. - name: Fetch Tags
  13. run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
  14. - name: Configure AWS credentials
  15. uses: aws-actions/configure-aws-credentials@v1
  16. with:
  17. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  18. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  19. aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
  20. aws-region: ${{ secrets.REGION }}
  21. - name: Set version
  22. id: version
  23. run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
  24. # Cache
  25. - uses: actions/cache@v1
  26. with:
  27. path: ~/.npm
  28. key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
  29. restore-keys: |
  30. ${{ runner.os }}-node-
  31. - uses: actions/cache@v1
  32. with:
  33. path: ~/.cache/pip
  34. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  35. restore-keys: |
  36. ${{ runner.os }}-pip-
  37. # Setup
  38. - name: Install Snappy
  39. run: sudo apt-get install libsnappy-dev
  40. - name: Set up Python 3.9
  41. uses: actions/setup-python@v1
  42. with:
  43. python-version: 3.9
  44. - name: Set up Nodejs 16
  45. uses: actions/setup-node@v1
  46. with:
  47. node-version: 16
  48. - name: Set up ruby 2.6
  49. uses: actions/setup-ruby@v1
  50. with:
  51. ruby-version: '2.6'
  52. - name: Install virtualenv
  53. run: pip install virtualenv
  54. - name: Install dependencies
  55. run: make setup
  56. # Package and Upload Archive
  57. - name: Build Release
  58. run: make package
  59. - name: Upload artefact
  60. run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-s3-find-and-forget/$VERSION/amazon-s3-find-and-forget.zip
  61. env:
  62. CFN_BUCKET: ${{ secrets.CFN_BUCKET }}