diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 48dfa754..fc3bbfdd 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -24,6 +24,7 @@ jobs: echo "RELEASE_FROM=$(elixir ./deploy/upgrade/handler.exs upgrade_from ./deploy/upgrade/prod.config)" >> $GITHUB_ENV echo "RELEASE_TO=$(elixir ./deploy/upgrade/handler.exs upgrade_to ./deploy/upgrade/prod.config)" >> $GITHUB_ENV echo "NAME=$(elixir ./deploy/upgrade/handler.exs name ./deploy/upgrade/prod.config)" >> $GITHUB_ENV + echo "TYPE=$(elixir ./deploy/upgrade/handler.exs type ./deploy/upgrade/prod.config)" >> $GITHUB_ENV - name: Setup Elixir run: | . ~/.asdf/asdf.sh @@ -33,12 +34,14 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@v1 with: - toolchain: stable + toolchain: stable - name: Get git tags run: git fetch --tags origin - name: Checkout RELEASE_FROM + if: env.TYPE == 'soft' run: git checkout v${{ env.RELEASE_FROM }} - name: Cache Mix + if: env.TYPE == 'soft' uses: actions/cache@v3 with: path: deps @@ -46,11 +49,13 @@ jobs: restore-keys: | ${{ runner.os }}-mix- - name: Install dependencies + if: env.TYPE == 'soft' run: | mix local.hex --force mix local.rebar --force mix deps.get - name: Make old release + if: env.TYPE == 'soft' run: mix release supavisor - name: Checkout RELEASE_TO run: git checkout v${{ env.RELEASE_TO }} @@ -61,18 +66,23 @@ jobs: key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} restore-keys: | ${{ runner.os }}-mix- + - name: Clean up old release(s) + if: env.TYPE == 'soft' + run: | + rm -rf ./_build/${{ env.MIX_ENV }}/lib/supavisor + rm ./_build/${{ env.MIX_ENV }}/rel/supavisor/releases/COOKIE + rm ./_build/${{ env.MIX_ENV }}/supavisor-${{ env.RELEASE_FROM }}.tar.gz - name: Install dependencies run: | mix local.hex --force mix local.rebar --force mix deps.get - - name: Clean up old release - run: | - rm -rf ./_build/${{ env.MIX_ENV }}/lib/supavisor - rm ./_build/${{ env.MIX_ENV }}/rel/supavisor/releases/COOKIE - rm ./_build/${{ env.MIX_ENV }}/supavisor-${{ env.RELEASE_FROM }}.tar.gz - name: Make upgrade release + if: env.TYPE == 'soft' run: RELEASE_COOKIE=${{ secrets.RELEASE_COOKIE_PROD }} UPGRADE_FROM=${{ env.RELEASE_FROM }} mix release supavisor + - name: Make hard ${{ env.RELEASE_TO }} release + if: env.TYPE == 'hard' + run: RELEASE_COOKIE=${{ secrets.RELEASE_COOKIE_PROD }} mix release supavisor - name: Create tarball run: cd _build/${{ env.MIX_ENV }} && mv supavisor-${{ env.RELEASE_TO }}.tar.gz "${{ env.NAME }}_$(date "+%s").tar.gz" - name: configure aws credentials - production @@ -82,4 +92,4 @@ jobs: aws-region: "us-east-1" - name: Deploy to S3 shell: bash - run: aws s3 sync ./_build/${{ env.MIX_ENV }} ${{ secrets.TARBALLS_PATH_PROD }} --exclude '*' --include '*tar.gz' + run: aws s3 sync ./_build/${{ env.MIX_ENV }} ${{ secrets.TARBALLS_PATH_PROD }} --exclude '*' --include '*tar.gz' \ No newline at end of file diff --git a/deploy/upgrade/prod.config b/deploy/upgrade/prod.config index 96dfadfa..7526ce56 100644 --- a/deploy/upgrade/prod.config +++ b/deploy/upgrade/prod.config @@ -1,9 +1,9 @@ [ {upgrade_from, "1.1.48"}, - {upgrade_to, "1.1.49"}, + {upgrade_to, "2.0.0"}, % list() | [<<"all">>] - {regions, [<<"all">>]}, + {regions, [<<"eu-west-3">>]}, % :soft | :hard - {type, soft} + {type, hard} ]. % supavisor_soft_all-1_1.1.13_1.1.39 \ No newline at end of file