Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove one need #216

Merged
merged 12 commits into from
Jul 26, 2024
32 changes: 9 additions & 23 deletions .github/workflows/deploy-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Read version from file
run: |
CURRENT_VERSION=$(cargo pkgid --manifest-path fplus-http-server/Cargo.toml | cut -d'#' -f2)
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Install cargo-edit
run: cargo install cargo-edit

- name: Update version
run: cargo set-version ${{ inputs.version }}

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run cargo check
run: cargo check

Expand All @@ -39,20 +31,14 @@ jobs:
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# - name: Commit version change
# run: |
# git commit -am "Update version to ${{ inputs.version }}"
# git push origin main
- name: Commit version change
run: |
git commit -am "Update version to ${{ inputs.version }}"
git push origin main
call-release-workflow:
runs-on: ubuntu-latest
needs: [check-version, update-lock-and-commit]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: "Check build and push release"
uses: ./.github/workflows/release-new-version.yml
with:
version: ${{ inputs.version }}
needs: check-version
uses: ./.github/workflows/release-new-version.yml
with:
version: ${{ inputs.version }}
secrets: inherit
23 changes: 9 additions & 14 deletions .github/workflows/release-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run tests
env:
GH_PRIVATE_KEY: ${{ secrets.GH_PRIVATE_KEY }}
Expand All @@ -97,9 +94,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down Expand Up @@ -128,10 +122,11 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=false
images: public.ecr.aws/f4h6r4m9/${{ env.ECR_REPOSITORY }}
tags: |
type=semver,pattern={{version}},value=v${{ inputs.version }}
type=ref,event=branch
type=semver,pattern={{version}},value=v${{ inputs.version }},enable=${{inputs.version != ''}}
type=raw,value={{branch}},enable=${{inputs.version != ''}}
type=ref,event=pr,pattern={{branch}}
- name: Build tag and push Docker image
Expand All @@ -144,9 +139,9 @@ jobs:
cache-to: type=gha,mode=max
github-token: ${{ secrets.GITHUB_TOKEN }}

# - name: Create and push tag
# if: inputs.version != ''
# run: |
# TAG_NAME="v${{ steps.meta.outputs.tags }}"
# git tag $TAG_NAME
# git push origin $TAG_NAME
- name: Create and push tag
if: ${{ github.ref == format('refs/heads/{0}', 'main') && inputs.version != '' }}
run: |
TAG_NAME="v${{ steps.meta.outputs.tags }}"
git tag $TAG_NAME
git push origin $TAG_NAME
Loading