From e1b95e91ea56524fade504e4c3ea47f199ebf4f4 Mon Sep 17 00:00:00 2001 From: syjn99 Date: Sat, 7 Sep 2024 15:43:09 +0900 Subject: [PATCH] Rollback aws upload step --- .github/workflows/tag-build.yml | 85 ++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tag-build.yml b/.github/workflows/tag-build.yml index 9694b92d6..741a1fa02 100644 --- a/.github/workflows/tag-build.yml +++ b/.github/workflows/tag-build.yml @@ -37,34 +37,63 @@ jobs: tag_name: ${{ needs.extract-version.outputs.tag_name }} version_name: ${{ needs.extract-version.outputs.version_name }} - # upload-aws: - # needs: [build, extract-version] - # runs-on: ubuntu-latest - # steps: - # - name: Configure AWS credentials - # uses: aws-actions/configure-aws-credentials@v1 - # with: - # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # aws-region: ${{ secrets.AWS_REGION }} - - # - name: Download artifacts - # uses: actions/download-artifact@v4 - # with: - # path: dist/${{ github.sha }} - - # - name: Upload to S3 - # run: | - # aws s3 cp dist/${{ github.sha }} \ - # s3://${{ secrets.AWS_BUCKET_NAME }}/${{ needs.extract-version.outputs.version_name }}/${{ needs.extract-version.outputs.tag_name }} \ - # --recursive --acl public-read - - # - name: Update latest S3 bucket (when version_name is stable) - # if: ${{ needs.extract-version.outputs.version_name == 'stable' }} - # run: | - # aws s3 cp dist/${{ github.sha }} \ - # s3://${{ secrets.AWS_BUCKET_NAME }}/latest/chronos \ - # --recursive --acl public-read + upload-aws: + needs: [build, extract-version] + runs-on: ubuntu-latest + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist/${{ github.sha }} + + - name: Upload to S3 + run: | + aws s3 cp dist/${{ github.sha }} \ + s3://${{ secrets.AWS_BUCKET_NAME }}/${{ needs.extract-version.outputs.version_name }}/${{ needs.extract-version.outputs.tag_name }} \ + --recursive --acl public-read + + upload-aws-latest: + needs: [build, extract-version] + runs-on: ubuntu-latest + if: ${{ needs.extract-version.outputs.tag_name == 'stable' }} + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist/${{ github.sha }} + + - name: Download latest.yml from S3 + run: | + aws s3 cp s3://${{ secrets.AWS_BUCKET_NAME }}/latest/latest.yml latest.yml + + - name: Update latest.yml file for chronos + run: | + echo "Updating chronos version and tag in latest.yml" + yq eval '.chronos.version = "${{ needs.extract-version.outputs.version_name }}" | .chronos.tag = "${{ needs.extract-version.outputs.tag_name }}"' -i latest.yml + + - name: Upload updated latest.yml to S3 + run: | + aws s3 cp latest.yml s3://${{ secrets.AWS_BUCKET_NAME }}/latest/latest.yml --acl public-read + + - name: Upload to S3 + run: | + aws s3 cp dist/${{ github.sha }} \ + s3://${{ secrets.AWS_BUCKET_NAME }}/latest/chronos \ + --recursive --acl public-read build-docker: needs: [extract-version]