Skip to content

Commit

Permalink
Merge pull request #4 from michalfita/chore/2/rename-the-project
Browse files Browse the repository at this point in the history
[FIxes #2] Prepare the repository rename
  • Loading branch information
dbast authored Dec 26, 2023
2 parents 23a4876 + f7181a0 commit ed4c68a
Show file tree
Hide file tree
Showing 41 changed files with 162 additions and 146 deletions.
86 changes: 43 additions & 43 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
mkaczanowski/packer-builder-arm
tags: |
type=ref,event=branch
type=ref,event=pr
type=match,pattern=v(.*),group=1
#- name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# mkaczanowski/packer-builder-arm
# tags: |
# type=ref,event=branch
# type=ref,event=pr
# type=match,pattern=v(.*),group=1

#### build+export, test only on PRs
- name: Build and export to Docker
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
load: true
tags: packer-builder-arm:test
labels: ${{ steps.meta.outputs.labels }}
#- name: Build and export to Docker
# if: github.event_name == 'pull_request'
# uses: docker/build-push-action@v5
# with:
# context: .
# file: docker/Dockerfile
# load: true
# tags: packer-plugin-cross:test
# labels: ${{ steps.meta.outputs.labels }}

- name: Install packer plugins
if: github.event_name == 'pull_request'
Expand All @@ -69,12 +69,12 @@ jobs:
du -h --apparent-size raspberry-pi-4.img
####

- name: Login to DockerHub
uses: docker/login-action@v3
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Login to DockerHub
# uses: docker/login-action@v3
# if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
# with:
# username: ${{ secrets.DOCKER_USER }}
# password: ${{ secrets.DOCKER_PASSWORD }}

# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
Expand All @@ -83,22 +83,22 @@ jobs:
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GHCR_IO_REGISTRY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }}
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
#- name: Build and push
# uses: docker/build-push-action@v5
# if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }}
# with:
# context: .
# file: docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

- name: Update description
uses: peter-evans/dockerhub-description@v3
if: github.ref == 'refs/heads/master'
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
short-description: Packer plugin to build ARM images
readme-filepath: ./README.md
#- name: Update description
# uses: peter-evans/dockerhub-description@v3
# if: github.ref == 'refs/heads/master'
# with:
# username: ${{ secrets.DOCKER_USER }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# short-description: Packer plugin to build ARM images
# readme-filepath: ./README.md
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20
- name: Describe plugin
id: plugin_describe
run: echo "api_version=$(go run . describe | jq -r '.api_version')" >> $GITHUB_OUTPUT
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
id: cache-key
uses: actions/cache@v3
with:
path: packer-builder-arm
path: packer-plugin-cross
key: key-${{ github.sha }}-1

- name: Checkout
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
if: steps.cache-key.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: packer-plugin-arm
path: packer-plugin-cross
key: key-${{ github.sha }}-1

test:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Retrieve cache
uses: actions/cache@v3
with:
path: packer-plugin-arm
path: packer-plugin-cross
key: key-${{ github.sha }}-1

- name: Install packer plugins
Expand Down Expand Up @@ -147,31 +147,31 @@ jobs:
git archive -o repo.tar.gz HEAD
vagrant upload repo.tar.gz /home/vagrant/repo.tar.gz
vagrant ssh -c " \
rm -rf packer-builder-arm && \
mkdir packer-builder-arm && \
tar -xf repo.tar.gz -C packer-builder-arm \
rm -rf packer-plugin-cross && \
mkdir packer-plugin-cross && \
tar -xf repo.tar.gz -C packer-plugin-cross \
"
- name: Retrieve cache
uses: actions/cache@v3
with:
path: packer-plugin-arm
path: packer-plugin-cross
key: key-${{ github.sha }}-1

- name: Upload packer-build-arm binary
run: |
vagrant upload packer-plugin-arm /home/vagrant/packer-builder-arm/packer-plugin-arm
vagrant upload packer-plugin-cross /home/vagrant/packer-plugin-cross/packer-plugin-cross
- name: Build board
run: |
vagrant ssh -c " \
cd packer-builder-arm && \
cd packer-plugin-cross && \
sudo PACKER_LOG=1 packer build boards/raspberry-pi-3/archlinuxarm.json \
"
- name: Check result
run: |
vagrant ssh -c "ls -al packer-builder-arm/raspberry-pi-3.img"
vagrant ssh -c "ls -al packer-plugin-cross/raspberry-pi-3.img"
plugin-check:
needs: compile
Expand All @@ -184,7 +184,7 @@ jobs:
- name: Retrieve cache
uses: actions/cache@v3
with:
path: packer-plugin-arm
path: packer-plugin-cross
key: key-${{ github.sha }}-1
- name: check
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
packer_cache
packer-builder-arm
packer-plugin-arm
packer-plugin-cross
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ builds:
goarch:
- amd64
- arm64
- riscv64
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
archives:
- format: zip
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NAME=arm
NAME=cross
BINARY=packer-plugin-${NAME}

HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
Expand Down
Loading

0 comments on commit ed4c68a

Please sign in to comment.