This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
release #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
workflow_dispatch: | |
workflow_call: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.clean_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
# TODO: Remove once https://crates.io/crates/opentelemetry-otlp is updated | |
# and no longer has a build requirement of `protoc``. | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
- name: "Install lld and llvm" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lld llvm | |
- name: "Cocogitto release" | |
id: release | |
uses: cocogitto/cocogitto-action@v3 | |
with: | |
check: true | |
check-latest-tag-only: true | |
release: true | |
git-user: "github-actions[bot]" | |
git-user-email: "github-actions[bot]@users.noreply.github.com" | |
- name: "Update version in Cargo.toml" | |
shell: bash | |
run: | | |
version=$(echo "${{ steps.release.outputs.version }}" | sed 's/v//g') | |
sed "s/^version = \".*\"\$/version = \"$version\"/" ./Cargo.toml > /tmp/cargo.toml | |
mv /tmp/cargo.toml ./Cargo.toml | |
# - name: "Commit version bump" | |
# uses: stefanzweifel/git-auto-commit-action@v4 | |
# with: | |
# commit_message: "chore: Bump version for release" | |
# file_pattern: "Cargo.toml Cargo.lock" | |
# commit_user_name: "github-actions[bot]" | |
# commit_user_email: "github-actions[bot]@users.noreply.github.com" | |
- name: "Install Rust toolchain (stable)" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Cache cargo registry | |
uses: Swatinem/rust-cache@v2 | |
- name: "Generate Changelog" | |
run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md | |
- name: "Update Github release notes" | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: GITHUB_CHANGELOG.md | |
tag_name: ${{ steps.release.outputs.version }} | |
token: ${{ secrets.PAT_VERSION_BUMP}} | |
- id: clean_version | |
run: | | |
version=$(echo "${{ steps.release.outputs.version }}" | sed 's/v//g') | |
echo "version=$version" >> $GITHUB_OUTPUT | |
build-container: | |
runs-on: ubuntu-latest | |
needs: | |
- release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_VERSION_BUMP}} | |
submodules: recursive | |
- 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: eu-central-1 | |
# Authenticate with ECR | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Login to GHCR | |
id: login-ghcr | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ steps.login-ecr.outputs.registry }}/cast-server | |
ghcr.io/walletconnect/cast-server | |
walletconnect/cast-server,enable=false | |
flavor: | | |
latest=auto | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=${{ needs.release.outputs.version }} | |
# Setup Buildkit | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build, tag, and push image to Amazon ECR | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
kick-off-cd: | |
needs: [build-container] | |
uses: ./.github/workflows/cd.yml | |
secrets: inherit |