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
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Docker
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/build-push-action@v2
|
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:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: false
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
- name: Set up Rust
|
tags: |
|
||||||
uses: actions-rs/toolchain@v1
|
user/app:latest
|
||||||
with:
|
user/app:1.0.0
|
||||||
profile: minimal
|
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:latest
|
||||||
toolchain: stable
|
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:${{ env.VERSION }}
|
||||||
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 }}"
|
|
Loading…
Reference in a new issue