-
-
Notifications
You must be signed in to change notification settings - Fork 34
88 lines (78 loc) · 2.5 KB
/
package_reusable.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: '_package'
on:
workflow_call:
inputs:
upload_artifacts:
description: 'If we should upload artifacts'
type: boolean
required: true
version:
description: 'The current value in version file (type: string)'
type: string
required: true
jobs:
aur_build:
name: build AUR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy
profile: minimal
- name: setup Rust
run: |
cargo install cargo-aur
cargo install cargo-generate-rpm
- name: run cargo aur and generate-rpm
run: |
cargo aur
cargo generate-rpm
- name: upload PKGBUILD artifact
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: PKGBUILD
path: ./target/cargo-aur/PKGBUILD
- name: upload ${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz artifact
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz
path: ./target/cargo-aur/${{ github.event.repository.name }}-${{ inputs.version }}-x86_64.tar.gz
docker:
name: docker
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
attestations: write
env:
# Hostname of your registry
REGISTRY: docker.io
REGISTRY_USER: xorio42
# Image repository, without hostname and tag
IMAGE_NAME: ${{ github.event.repository.name }}
IMAGE_TAG: latest
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
steps:
- uses: actions/checkout@v4
- name: log in to Docker Hub
if: inputs.upload_artifacts
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build push = ${{ inputs.upload_artifacts }}
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
push: ${{ inputs.upload_artifacts }}
tags: ${{ env.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
sbom: true
provenance: true