Action #5
This commit is contained in:
parent
c1fb7005df
commit
0329f40807
1 changed files with 26 additions and 29 deletions
55
.github/workflows/main.yml
vendored
55
.github/workflows/main.yml
vendored
|
@ -18,34 +18,31 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker
|
||||
uses: docker/build-push-action@v2
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.DOCKER_REGISTRY }}
|
||||
username: ${{ env.DOCKER_USERNAME }}
|
||||
password: ${{ env.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Cargo install
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: install
|
||||
args: cargo-semver
|
||||
|
||||
- name: Semver
|
||||
run:
|
||||
echo "VERSION=$(cargo semver get)" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Install libavutil development package
|
||||
run: sudo apt-get update && sudo apt-get install -y libavutil-dev
|
||||
|
||||
|
||||
- name: Install Cargo Dependencies
|
||||
run: cargo install metadata
|
||||
|
||||
- name: Get App Version
|
||||
id: version
|
||||
run: cargo metadata --format-version 1 | jq -r '.packages[0].version'
|
||||
|
||||
- name: Login to Docker registry
|
||||
run: echo "${{ env.DOCKER_PASSWORD }}" | docker login -u "${{ env.DOCKER_USERNAME }}" --password-stdin "${{ env.DOCKER_REGISTRY }}"
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
docker build --pull --cache-from "${{ env.DOCKER_REGISTRY }}/your-image:${{ steps.version.outputs.version }}" --tag "${{ env.DOCKER_REGISTRY }}/your-image:${{ steps.version.outputs.version }}" .
|
||||
docker push "${{ env.DOCKER_REGISTRY }}/your-image:${{ steps.version.outputs.version }}"
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
user/app:latest
|
||||
user/app:1.0.0
|
||||
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:latest
|
||||
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:${{ env.VERSION }}
|
Loading…
Reference in a new issue